コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    WorkerID = Utils.GetInt(Request.QueryString["WorkerID"], -1);
            string Method   = Utils.GetFormValue("hidMethod");

            if (!IsPostBack && WorkerID != -1) //初始化
            {
                EyouSoft.BLL.AdminCenterStructure.ContractInfo   bllContractInfo   = new EyouSoft.BLL.AdminCenterStructure.ContractInfo();
                EyouSoft.Model.AdminCenterStructure.ContractInfo modelContractInfo = bllContractInfo.GetModel(CurrentUserCompanyID, WorkerID);
                if (modelContractInfo != null)
                {
                    this.hidWorkerID.Value     = modelContractInfo.Id.ToString();
                    this.dpState.SelectedIndex = (int)modelContractInfo.ContractStatus;
                    WorkerNO   = modelContractInfo.StaffNo;
                    WorkerName = modelContractInfo.StaffName;
                    BeginDate  = modelContractInfo.BeginDate;
                    EndDate    = modelContractInfo.EndDate;
                    Reamrk     = modelContractInfo.Remark;
                }
            }
            if (Method == "save")
            {
                if (Utils.GetInt(this.hidWorkerID.Value, -1) != -1)     //  修改权限
                {
                    if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_修改合同))
                    {
                        Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_修改合同, true);
                    }
                }
                else
                {
                    if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_新增合同))
                    {
                        Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_新增合同, true);
                    }
                }
                EyouSoft.BLL.AdminCenterStructure.ContractInfo   bllContractInfo   = new EyouSoft.BLL.AdminCenterStructure.ContractInfo();
                EyouSoft.Model.AdminCenterStructure.ContractInfo modelContractInfo = new EyouSoft.Model.AdminCenterStructure.ContractInfo();
                modelContractInfo.CompanyId = CurrentUserCompanyID;
                modelContractInfo.StaffNo   = Utils.GetFormValue("txt_WorkerNO");
                modelContractInfo.StaffName = Utils.GetFormValue("txt_WorkerName");
                if (Utils.GetDateTime(Request.Form["txt_BeginDate"]) != null)
                {
                    modelContractInfo.BeginDate = Utils.GetDateTime(Request.Form["txt_BeginDate"]);
                }
                if (Utils.GetDateTime(Request.Form["txt_EndDate"]) != null)
                {
                    modelContractInfo.EndDate = Utils.GetDateTime(Request.Form["txt_EndDate"]);
                }
                modelContractInfo.Remark         = Utils.GetFormValue("txt_Reamrk");
                modelContractInfo.ContractStatus = (EyouSoft.Model.EnumType.AdminCenterStructure.ContractStatus) this.dpState.SelectedIndex;
                if (Utils.GetInt(this.hidWorkerID.Value, -1) != -1)     //  修改
                {
                    modelContractInfo.Id = Utils.GetInt(this.hidWorkerID.Value);
                    if (bllContractInfo.Update(modelContractInfo))
                    {
                        MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "修改成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/contractManage/Default.aspx"));
                    }
                    else
                    {
                        MessageBox.Show(this.Page, "修改失败!");
                    }
                }
                else                            //新增
                {
                    if (bllContractInfo.Add(modelContractInfo))
                    {
                        MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "新增成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/contractManage/Default.aspx"));
                    }
                    else
                    {
                        MessageBox.Show(this.Page, "新增失败!");
                    }
                }
            }
        }
コード例 #2
0
ファイル: AjaxContractList.aspx.cs プロジェクト: windygu/bbl
        protected void Page_Load(object sender, EventArgs e)
        {
            PageIndex = Utils.GetInt(Request.QueryString["Page"], 1);
            string method   = Utils.GetQueryStringValue("Method");
            int    WorkerID = Utils.GetInt(Request.QueryString["WorkerID"], -1);


            if (!IsPostBack && method == "")          //查询
            {
                if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_修改合同))
                {
                    EditFlag = true;
                }
                if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_删除合同))
                {
                    DeleteFlag = true;
                }
                string   WorkerNo           = Utils.GetQueryStringValue("WorkerNo");
                string   WorkerName         = Utils.GetQueryStringValue("WorkerName");
                DateTime?TimeOfSigningStart = Utils.GetDateTimeNullable(Request.QueryString["TimeOfSigningStart"]);
                DateTime?TimeOfSigningEnd   = Utils.GetDateTimeNullable(Request.QueryString["TimeOfSigningEnd"]);
                DateTime?ComeDueStart       = Utils.GetDateTimeNullable(Request.QueryString["ComeDueStart"]);
                DateTime?ComeDueEnd         = Utils.GetDateTimeNullable(Request.QueryString["ComeDueEnd"]);

                EyouSoft.BLL.AdminCenterStructure.ContractInfo         bllContractInfo = new EyouSoft.BLL.AdminCenterStructure.ContractInfo();
                EyouSoft.Model.AdminCenterStructure.ContractSearchInfo searchInfo      = new EyouSoft.Model.AdminCenterStructure.ContractSearchInfo();
                searchInfo.StaffNo   = WorkerNo;
                searchInfo.StaffName = WorkerName;
                searchInfo.BeginFrom = TimeOfSigningStart;
                searchInfo.BeginTo   = TimeOfSigningEnd;
                searchInfo.EndFrom   = ComeDueStart;
                searchInfo.EndTo     = ComeDueEnd;
                IList <EyouSoft.Model.AdminCenterStructure.ContractInfo> listContractInfo = bllContractInfo.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, searchInfo);
                if (listContractInfo != null && listContractInfo.Count > 0)
                {
                    this.crptContractList.DataSource = listContractInfo;
                    this.crptContractList.DataBind();
                    BindPage();
                }
                else
                {
                    this.crptContractList.EmptyText   = "<tr><td colspan=\"8\"><div style=\"text-align:center;  margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>";
                    this.ExporPageInfoSelect1.Visible = false;
                }
            }
            if (method == "DeleteContract" && WorkerID != -1)                           //删除
            {
                if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_劳动合同管理_删除合同)) //删除权限判断
                {
                    Response.Clear();
                    Response.Write("NoPermission");
                    Response.End();
                }
                else
                {
                    EyouSoft.BLL.AdminCenterStructure.ContractInfo bllContractInfo = new EyouSoft.BLL.AdminCenterStructure.ContractInfo();
                    if (bllContractInfo.Delete(CurrentUserCompanyID, WorkerID))
                    {
                        Response.Clear();
                        Response.Write("True");
                        Response.End();
                    }
                    else
                    {
                        Response.Clear();
                        Response.Write("False");
                        Response.End();
                    }
                }
            }
        }