123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using DAL;
- using Models;
- using OA2014.publicCode;
- using System.Transactions;
- namespace OA2014.groups
- {
- public partial class invitationOfficialActivities : SessionCode
- {
- //分页设置
- int sumPage = 0;
- int totalRecord = 0;
- string url = "../groups/invitationOfficialActivities.aspx";
- /// <summary>
- /// 加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- string arrayUsersId = null;
- string arrayTourCodeId = null;
- GroupsTaskAssignmentService gtas = new GroupsTaskAssignmentService();
- List<GroupsTaskAssignment> gtaUIdList = gtas.GetAllByUIdAndCTId(UserId.ToString(), "81");
- foreach (GroupsTaskAssignment gta in gtaUIdList)
- arrayTourCodeId += gta.DIId + ",";
- bindDDL(arrayTourCodeId);
- List<GroupsTaskAssignment> gtaList = gtas.GetAll(ddlTourCode.SelectedValue, "81");
- foreach (GroupsTaskAssignment gta in gtaList)
- arrayUsersId += gta.UId + ",";
- bind(arrayUsersId);
- bindContent();
- }
- }
- /// <summary>
- /// 绑定下拉列表
- /// </summary>
- void bindDDL(string arrayTourCodeId)
- {
- DelegationInfoService dis = new DelegationInfoService();
- if (!string.IsNullOrEmpty(arrayTourCodeId))
- arrayTourCodeId = arrayTourCodeId.TrimEnd(',');
- ddlTourCode.DataSource = dis.GetAllByTourCodeInId(arrayTourCodeId);
- ddlTourCode.DataTextField = "TeamName";
- ddlTourCode.DataValueField = "Id";
- ddlTourCode.DataBind();
- if (Request.QueryString["tourCode"] != null && !string.IsNullOrEmpty(Request.QueryString["tourCode"].ToString()))
- ddlTourCode.Items.FindByValue(Request.QueryString["tourCode"].ToString()).Selected = true;
- if (Request.QueryString["inviter"] != null && !string.IsNullOrEmpty(Request.QueryString["inviter"].ToString()))
- txtInviter.Text = Request.QueryString["inviter"].ToString();
- if (Request.QueryString["startTime"] != null && !string.IsNullOrEmpty(Request.QueryString["startTime"].ToString()))
- txtStartTime.Text = Request.QueryString["startTime"].ToString();
- if (Request.QueryString["endTime"] != null && !string.IsNullOrEmpty(Request.QueryString["endTime"].ToString()))
- txtEndTime.Text = Request.QueryString["endTime"].ToString();
- }
- /// <summary>
- /// 根据团号下拉列表绑定数据
- /// </summary>
- void bindContent()
- {
- DelegationInfoService dis = new DelegationInfoService();
- if (ddlTourCode.SelectedValue != "0")
- {
- DelegationInfo di = dis.GetDelegationInfoByID(Convert.ToInt32(ddlTourCode.SelectedValue));
- lblTeamName.Text = di.TourCode;
- lblClientName.Text = di.ClientName;
- lblVisitCountry.Text = di.VisitCountry;
- lblStartTime.Text = di.VisitStartDate;
- lblEndTime.Text = di.VisitEndDate;
- lblVisitDays.Text = di.VisitDays.ToString();
- lblPNumber.Text = di.VisitPNumber.ToString();
- }
- else
- {
- PublicCode.GetAlertMsg(this, GetType(), "请联系操作部经理分配任务!");
- }
- }
- /// <summary>
- /// 绑定事件
- /// </summary>
- void bind(string arrayUsersId)
- {
- try
- {
- InvitationOfficialActivitiesService ioas = new InvitationOfficialActivitiesService();
- //url传递参数设置
- pageControl.Params = "&tourCode=" + ddlTourCode.SelectedValue + "&inviter=" + txtInviter.Text + "&startTime=" + txtStartTime.Text + "&endTime=" + txtEndTime.Text;
- //分页设置
- int pageIndex = pageControl.getPageIndex();
- if (!string.IsNullOrEmpty(arrayUsersId))
- arrayUsersId = arrayUsersId.TrimEnd(',');
- rpData.DataSource = ioas.GetInvitationOfficialActivities(pageIndex, out sumPage, out totalRecord, ddlTourCode.SelectedValue, txtInviter.Text, txtStartTime.Text, txtEndTime.Text, arrayUsersId);
- rpData.DataBind();
- //绑定分页用户控件
- pageControl.bind(pageIndex, sumPage, totalRecord, url);
- }
- catch
- {
- PublicCode.GetAlertMsg(this, GetType(), "请联系操作部经理分配任务!");
- }
- }
- /// <summary>
- /// 查询事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnSelect_Click(object sender, EventArgs e)
- {
- Response.Redirect("invitationOfficialActivities.aspx?Page=1&tourCode=" + ddlTourCode.SelectedValue + "&inviter=" + txtInviter.Text + "&startTime=" + txtStartTime.Text + "&endTime=" + txtEndTime.Text);
- }
- /// <summary>
- /// 新增事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnAdd_Click(object sender, EventArgs e)
- {
- Response.Redirect("addInvitationOfficialActivities.aspx?tourCode=" + ddlTourCode.SelectedValue);
- }
- /// <summary>
- /// 团号下拉列表值改变时触发的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void ddlTourCode_TextChanged(object sender, EventArgs e)
- {
- Response.Redirect("invitationOfficialActivities.aspx?Page=1&tourCode=" + ddlTourCode.SelectedValue + "&inviter=" + txtInviter.Text + "&startTime=" + txtStartTime.Text + "&endTime=" + txtEndTime.Text);
- }
- /// <summary>
- /// 行数据绑定后激发的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void rpData_ItemDataBound(object sender, RepeaterItemEventArgs e)
- {
- int currencyVal = Convert.ToInt32((e.Item.FindControl("lblCurrencyVal") as Label).Text);
- SetDataService sds = new SetDataService();
- SetData sd = sds.GetSetDataByID(currencyVal);
- if (sd != null)
- (e.Item.FindControl("lblCurrency") as Label).Text = sd.Name;
- else (e.Item.FindControl("lblCurrency") as Label).Text = "CNY";
- int SendCurrencyVal = Convert.ToInt32((e.Item.FindControl("SendCurrencyVal") as Label).Text);
- SetData sd1 = sds.GetSetDataByID(SendCurrencyVal);
- if (sd1 != null)
- (e.Item.FindControl("lblSendCurrency") as Label).Text = sd1.Name;
- else (e.Item.FindControl("lblSendCurrency") as Label).Text = "CNY";
- int EventsCurrencyVal = Convert.ToInt32((e.Item.FindControl("EventsCurrencyVal") as Label).Text);
- SetData sd2 = sds.GetSetDataByID(EventsCurrencyVal);
- if (sd2 != null)
- (e.Item.FindControl("lblEventsCurrency") as Label).Text = sd2.Name;
- else (e.Item.FindControl("lblEventsCurrency") as Label).Text = "CNY";
- int TranslateCurrencyVal = Convert.ToInt32((e.Item.FindControl("TranslateCurrencyVal") as Label).Text);
- SetData sd3 = sds.GetSetDataByID(TranslateCurrencyVal);
- if (sd3 != null)
- (e.Item.FindControl("lblTranslateCurrency") as Label).Text = sd3.Name;
- else (e.Item.FindControl("lblTranslateCurrency") as Label).Text = "CNY";
- CreditCardPaymentService ccps = new CreditCardPaymentService();
- CreditCardPayment C = ccps.GetCreditCardPaymentByCIDAndDIIDAndCTable
- (Convert.ToInt32((e.Item.FindControl("lbtnEdit") as LinkButton).CommandArgument), Convert.ToInt32(ddlTourCode.SelectedValue), 81);
- if (C != null)
- {
-
- (e.Item.FindControl("isAudit") as Label).Text = C.IsAuditGM == 1 ? "已审核" : "未审核";
- }
- else
- {
-
- (e.Item.FindControl("lblOperators") as Label).Text = "未审核";
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void lbtnEdit_Click(object sender, EventArgs e)
- {
- Response.Redirect("editInvitationOfficialActivities.aspx?id=" + (sender as LinkButton).CommandArgument);
- }
- /// <summary>
- /// 删除事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void lbtnDel_Click(object sender, EventArgs e)
- {
- CreditCardPayment ccp = new CreditCardPayment();
- CreditCardPaymentService ccps = new CreditCardPaymentService();
- ccp = ccps.GetCreditCardPaymentByCIDAndDIIDAndCTable(Convert.ToInt32((sender as LinkButton).CommandArgument), Convert.ToInt32(ddlTourCode.SelectedValue), 81);
- //已经审核的记录不能被修改
- if (ccp != null)
- {
- if (ccp.IsAuditGM == 1 || ccp.IsAuditMF == 1)
- {
- PublicCode.GetAlertMsg(this, GetType(), "删除失败,该记录总经理已经审核完成不可再删除!");
- return;
- }
- }
- int id = Convert.ToInt32((sender as LinkButton).CommandArgument);
- InvitationOfficialActivitiesService ioas = new InvitationOfficialActivitiesService();
- using (TransactionScope ts = new TransactionScope())
- {
- if (ioas.DelInvitationOfficialActivities(id))
- {
- if (ccps.GetCreditCardPaymentByCIDAndDIIDAndCTable(id, Convert.ToInt32(ddlTourCode.SelectedValue), 81) != null)
- {
- if (ccps.DelCreditCardPayment(id, Convert.ToInt32(ddlTourCode.SelectedValue)))
- {
- ts.Complete();
- Response.Write("<script>alert('温馨提示:" + PublicCode.AlertMsgTrue + "');location.href='invitationOfficialActivities.aspx?Page=1&tourCode=" + ddlTourCode.SelectedValue + "&inviter=" + txtInviter.Text + "&startTime=" + txtStartTime.Text + "&endTime=" + txtEndTime.Text + "';</script>");
- }
- else
- {
- PublicCode.GetAlertMsg(this, GetType(), PublicCode.AlertMsgFalse);
- return;
- }
- }
- else
- {
- ts.Complete();
- Response.Write("<script>alert('温馨提示:" + PublicCode.AlertMsgTrue + "');location.href='invitationOfficialActivities.aspx?Page=1&tourCode=" + ddlTourCode.SelectedValue + "&inviter=" + txtInviter.Text + "&startTime=" + txtStartTime.Text + "&endTime=" + txtEndTime.Text + "';</script>");
- }
- }
- }
- }
- /// <summary>
- /// 附件下载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void lbtnDown_Click(object sender, EventArgs e)
- {
- string vals = (sender as LinkButton).CommandArgument;
- if (!string.IsNullOrEmpty(vals))
- {
- string attStr = (sender as LinkButton).CommandArgument;
- string filePath = AppDomain.CurrentDomain.BaseDirectory + @"UploadFile\";//路径
- string fileName = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".zip";
- if (!string.IsNullOrEmpty(attStr))
- {
- PublicCode.ZipFileMain(attStr.Split(','), fileName, filePath, 0);
- PublicCode.DownloadFile(Response, fileName, filePath);
- }
- }
- else
- {
- PublicCode.GetAlertMsg(this, GetType(), "未发现附件!");
- }
- }
- }
- }
|