Esempio n. 1
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        UD_WebPageBLL bll;

        if (ViewState["ID"] == null)
        {
            bll = new UD_WebPageBLL();
        }
        else
        {
            bll = new UD_WebPageBLL((Guid)ViewState["ID"]);
        }

        UC_DetailView1.GetData(bll.Model);

        if (ViewState["ID"] == null)
        {
            bll.Add();
        }
        else
        {
            bll.Update();
        }
        Response.Redirect("WebPageDetail.aspx?ID=" + bll.Model.ID.ToString());
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FNA_StaffSalary_ParamBLL bll = ViewState["ID"] != null ? new FNA_StaffSalary_ParamBLL((int)ViewState["ID"]) : new FNA_StaffSalary_ParamBLL();

        UC_DetailView1.GetData(bll.Model);
        if (bll.Model.Position == 1)
        {
            MessageBox.Show(this, "请选择职位");
            return;
        }
        if (ViewState["ID"] != null)
        {
            bll.Update();
        }
        else
        {
            if (FNA_StaffSalary_ParamBLL.GetModelList("Position=" + bll.Model.Position.ToString()).Count > 0)
            {
                MessageBox.Show(this, "对不起,该职位的绩效参数已维护,请勿重复!");
                return;
            }
            bll.Add();
        }
        UC_DetailView1.BindData(new FNA_StaffSalary_Param());
        ViewState["ID"] = null;
        BindGrid();
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        CM_LinkManBLL _lm = null;

        if (bt_OK.Text == "确 定")
        {
            _lm = new CM_LinkManBLL();
        }
        else
        {
            _lm = new CM_LinkManBLL((int)ViewState["ID"]);
        }

        UC_DetailView1.GetData(_lm.Model);

        if (bt_OK.Text == "确 定")
        {
            ViewState["ID"] = _lm.Add();
            string path = "LinkManDetail.aspx?ID=" + ViewState["ID"].ToString();
            if (Request.QueryString["URL"] != null)
            {
                path = Page.ResolveUrl(Request.QueryString["URL"] + "?ClientID=" + Request.QueryString["ClientID"]);
            }
            MessageBox.ShowAndRedirect(this, "保存联系人资料成功!", path);
        }
        else
        {
            _lm.Update();
            MessageBox.ShowAndRedirect(this, "保存联系人资料成功!", "LinkManDetail.aspx?ID=" + ViewState["ID"].ToString());
        }
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        UD_WebPageControlBLL bll;

        if (ViewState["ID"] == null)
        {
            bll = new UD_WebPageControlBLL();
        }
        else
        {
            bll = new UD_WebPageControlBLL((Guid)ViewState["ID"]);
        }

        UC_DetailView1.GetData(bll.Model);

        if (ViewState["ID"] == null)
        {
            bll.Model.WebPageID = (Guid)ViewState["WebPageID"];
            bll.Add();
        }
        else
        {
            bll.Update();
        }
        DataCache.RemoveCache("UD_WebPage-WebControls-" + bll.Model.WebPageID.ToString());
        Response.Redirect("WebPageControlList.aspx?WebPageID=" + ViewState["WebPageID"].ToString());
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        CM_KPIBLL _bll = null;

        if ((int)ViewState["ID"] == 0)
        {
            _bll = new CM_KPIBLL();
        }
        else
        {
            _bll = new CM_KPIBLL((int)ViewState["ID"]);
        }

        UC_DetailView1.GetData(_bll.Model);
        _bll.Model.TotalScore = ComputeTotalScore();

        #region 判断必填项
        if (_bll.Model.Client == 0)
        {
            MessageBox.Show(this, "经销商必填!");
            return;
        }
        #endregion


        if ((int)ViewState["ID"] == 0)
        {
            _bll.Model.InsertStaff = (int)Session["UserID"];
            _bll.Model.ApproveFlag = 2;
            ViewState["ID"]        = _bll.Add();
        }
        else
        {
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            _bll.Update();
        }

        MessageBox.ShowAndRedirect(this, "保存经销商KPI考核资料成功!", "KPIList.aspx?ClientID=" + _bll.Model.Client.ToString());
    }
Esempio n. 6
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_ClientPaymentInfoBLL bll;

        if ((int)ViewState["ID"] == 0)
        {
            bll = new FNA_ClientPaymentInfoBLL();
        }
        else
        {
            bll = new FNA_ClientPaymentInfoBLL((int)ViewState["ID"]);
        }

        UC_DetailView1.GetData(bll.Model);

        if (bll.Model.Client == 0)
        {
            MessageBox.Show(this, "对不起,请选择回款的经销商!");
            return;
        }
        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model.ApproveFlag = 2;
            ViewState["ID"]       = bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (sender != null)
        {
            Response.Redirect("ClientPaymentDetail.aspx?ID=" + ViewState["ID"].ToString());
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        PM_PromotorBLL _promotor = new PM_PromotorBLL((int)ViewState["PromotorID"]);

        if (_promotor.Model["State"] == "2")
        {
            MessageBox.Show(this, "该导购有未完成的流程,请待流程完成后,再做调整!");
            return;
        }
        DropDownList ddl_Classfiy      = DV_pm.FindControl("PM_Promotor_Classfiy") as DropDownList;
        TextBox      tbx_BeginWorkDate = DV_pm.FindControl("PM_Promotor_BeginWorkDate") as TextBox;
        TextBox      tbx_Remark        = DV_pm.FindControl("PM_Promotor_Education") as TextBox;
        TextBox      tbx_AccountNO     = (TextBox)DV_pm.FindControl("PM_Promotor_AccountCode");

        if (ddl_BankType.SelectedValue == "0" || txt_BankName.Text.Trim() == "")
        {
            MessageBox.Show(this, "请选择开户行!");
            return;
        }

        if (ddl_Classfiy.SelectedValue != "0" && tbx_BeginWorkDate.Text.Trim() != "")
        {
            int budget = PM_PromotorNumberLimitBLL.CheckOverBudget(_promotor.Model.OrganizeCity, int.Parse(_promotor.Model["Classfiy"]));
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", ViewState["PromotorID"].ToString());
            dataobjects.Add("OrganizeCity", _promotor.Model.OrganizeCity.ToString());
            dataobjects.Add("BeginWorkDate", tbx_BeginWorkDate.Text.ToString());
            dataobjects.Add("Classify", ddl_Classfiy.SelectedValue);
            dataobjects.Add("Remark", tbx_Remark.Text);
            dataobjects.Add("PM_Name", _promotor.Model.Name.ToString());
            dataobjects.Add("BankType", ddl_BankType.SelectedValue);
            dataobjects.Add("BankName", txt_BankName.Text.Trim());
            dataobjects.Add("AccountNO", tbx_AccountNO.Text.Trim());
            PM_PromotorSalaryBLL bll = new PM_PromotorSalaryBLL();
            UC_DetailView1.GetData(bll.Model);
            #region 数据录入判断
            if (bll.Model.BasePayMode == 0)
            {
                MessageBox.Show(this, "请选择正确的底薪模式!");
                return;
            }
            if (bll.Model.BasePayMode == 1)
            {
                if (bll.Model.SeniorityPayMode == 0)
                {
                    MessageBox.Show(this, "当底薪模式为固定底薪时,必须选择工龄工资模式!");
                    return;
                }
                if (bll.Model.InsuranceMode == 0)
                {
                    MessageBox.Show(this, "当底薪模式为固定底薪时,必须选择社保!");
                    return;
                }
            }
            if (bll.Model.BasePaySubsidyMode != 0 && bll.Model.BasePaySubsidy == 0)
            {
                MessageBox.Show(this, "当选择了底薪补贴类型时,请设定补贴金额!");
                return;
            }

            if (bll.Model.BasePaySubsidyMode != 0 && bll.Model.BasePaySubsidyBeginDate.Year == 1900)
            {
                MessageBox.Show(this, "当选择了底薪补贴类型时,请设定底薪补贴起始日期!");
                return;
            }
            if (bll.Model.BasePaySubsidyMode == 1 && bll.Model.BasePaySubsidyEndDate.Year == 1900)
            {
                MessageBox.Show(this, "当选择了底薪补贴类型为临时补贴时,请设定底薪补贴截止日期!");
                return;
            }

            if (bll.Model.MinimumWageMode == 2 && bll.Model.MinimumWage == 0)
            {
                MessageBox.Show(this, "当选择了特殊保底时,请设定保底金额!");
                return;
            }

            if (bll.Model.MinimumWageMode != 0 && bll.Model.MinimumWageBeginDate.Year == 1900)
            {
                MessageBox.Show(this, "当选择了薪资保底时,请设定保底的起始日期!");
                return;
            }
            if (bll.Model.MinimumWageMode != 0 && bll.Model.MinimumWageEndDate.Year == 1900)
            {
                MessageBox.Show(this, "当选择了薪资保底时,请设定保底的截止日期!");
                return;
            }
            if (bll.Model.InsuranceMode == 0 && bll.Model.BasePayMode != 3)
            {
                MessageBox.Show(this, "非兼职,请选择正确的社保模式!");
                return;
            }
            if (bll.Model.InsuranceMode == 1 && bll.Model.InsuranceSubsidy <= 0)
            {
                MessageBox.Show(this, "请正确输入保险补贴金额!");
                return;
            }
            if (bll.Model.BasePayMode == 4 && bll.Model["FloatingTarget"] == "0")
            {
                MessageBox.Show(this, "当底薪模式为浮动底薪(非华南)时,请设定浮动底薪上限任务量!");
                return;
            }
            if (bll.Model.BasePayMode == 4 && bll.Model["AvgSales"] == "0")
            {
                MessageBox.Show(this, "当底薪模式为浮动底薪(非华南)时,请设定前两月平均销量!");
                return;
            }
            if (bll.Model.BasePayMode == 5 && bll.Model["SalesType"] == "0")
            {
                MessageBox.Show(this, "当底薪模式为浮动底薪(华南)时,请设定实销类别!");
                return;
            }
            if (bll.Model.BasePayMode == 5 && bll.Model["BaseFeeRate"] == "0")
            {
                MessageBox.Show(this, "当底薪模式为浮动底薪(华南)时,请设定底薪费率!");
                return;
            }
            #endregion
            int TaskID = EWF_TaskBLL.NewTask("PMClassify_Change", (int)Session["UserID"], "导购员类型变更流程,姓名:" + _promotor.Model.Name, "~/SubModule/PM/PM_PromotorDetail.aspx?PromotorID=" + ViewState["PromotorID"].ToString(), dataobjects);
            if (TaskID > 0)
            {
                bll.Model.Promotor    = (int)ViewState["PromotorID"];
                bll.Model.State       = 2;
                bll.Model.ApproveTask = TaskID;
                bll.Model.ApproveFlag = 2;
                bll.Model.InsertStaff = (int)Session["UserID"];
                bll.Add();
                _promotor.Submit(TaskID, (int)Session["UserID"]);
                new EWF_TaskBLL(TaskID).Start();
                MessageBox.ShowAndClose(this, "流程发起成功!");
            }
        }
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        PM_PromotorSalaryBLL bll;

        if ((int)ViewState["PromotorSalaryID"] == 0)
        {
            bll = new PM_PromotorSalaryBLL();
        }
        else
        {
            bll = new PM_PromotorSalaryBLL((int)ViewState["PromotorSalaryID"]);
        }

        UC_DetailView1.GetData(bll.Model);

        #region 数据录入判断
        if (bll.Model.BasePayMode == 0)
        {
            MessageBox.Show(this, "请选择正确的底薪模式!");
            return;
        }
        if (bll.Model.BasePayMode == 1)
        {
            if (bll.Model.SeniorityPayMode == 0)
            {
                MessageBox.Show(this, "当底薪模式为固定底薪时,必须选择工龄工资模式!");
                return;
            }
            if (bll.Model.InsuranceMode == 0)
            {
                MessageBox.Show(this, "当底薪模式为固定底薪时,必须选择社保!");
                return;
            }
        }
        if (bll.Model.BasePaySubsidyMode != 0 && bll.Model.BasePaySubsidy == 0)
        {
            MessageBox.Show(this, "当选择了底薪补贴类型时,请设定补贴金额!");
            return;
        }

        if (bll.Model.BasePaySubsidyMode != 0 && bll.Model.BasePaySubsidyBeginDate.Year == 1900)
        {
            MessageBox.Show(this, "当选择了底薪补贴类型时,请设定底薪补贴起始日期!");
            return;
        }
        if (bll.Model.BasePaySubsidyMode == 1 && bll.Model.BasePaySubsidyEndDate.Year == 1900)
        {
            MessageBox.Show(this, "当选择了底薪补贴类型为临时补贴时,请设定底薪补贴截止日期!");
            return;
        }

        decimal BasePaySubsidylimt = 0;
        decimal.TryParse(Addr_OrganizeCityParamBLL.GetValueByType(1, 22), out BasePaySubsidylimt);
        if (BasePaySubsidylimt > 0 && BasePaySubsidylimt < bll.Model.BasePaySubsidy)
        {
            MessageBox.Show(this, "底薪补贴不得超过上限" + BasePaySubsidylimt.ToString() + "元");
            return;
        }

        if (bll.Model.MinimumWageMode == 2 && bll.Model.MinimumWage == 0)
        {
            MessageBox.Show(this, "当选择了特殊保底时,请设定保底金额!");
            return;
        }
        decimal MinimumWagelimit = 0;
        decimal.TryParse(Addr_OrganizeCityParamBLL.GetValueByType(1, 23), out MinimumWagelimit);
        if (bll.Model.MinimumWageMode == 2 && MinimumWagelimit > 0 && MinimumWagelimit < bll.Model.MinimumWage)
        {
            MessageBox.Show(this, "当选择了特殊保底时,保底工资不能超过上限" + MinimumWagelimit.ToString() + "元!");
            return;
        }
        if (bll.Model.MinimumWageMode != 0 && bll.Model.MinimumWageBeginDate.Year == 1900)
        {
            MessageBox.Show(this, "当选择了薪资保底时,请设定保底的起始日期!");
            return;
        }
        if (bll.Model.MinimumWageMode != 0 && bll.Model.MinimumWageEndDate.Year == 1900)
        {
            MessageBox.Show(this, "当选择了薪资保底时,请设定保底的截止日期!");
            return;
        }
        if (bll.Model.InsuranceMode == 0 && bll.Model.BasePayMode != 3)
        {
            MessageBox.Show(this, "非兼职,请选择正确的社保模式!");
            return;
        }
        if (bll.Model.InsuranceMode == 1 && bll.Model.InsuranceSubsidy <= 0)
        {
            MessageBox.Show(this, "请正确输入保险补贴金额!");
            return;
        }
        if (bll.Model.BasePayMode == 4 && bll.Model["FloatingTarget"] == "0")
        {
            MessageBox.Show(this, "当底薪模式为浮动底薪(非华南)时,请设定浮动底薪上限任务量!");
            return;
        }
        if (bll.Model.BasePayMode == 4 && bll.Model["AvgSales"] == "0")
        {
            MessageBox.Show(this, "当底薪模式为浮动底薪(非华南)时,请设定前两月平均销量!");
            return;
        }
        //if (bll.Model.BasePayMode == 4 && bll.Model["BaseFeeRate"] == "0")
        //{
        //    MessageBox.Show(this, "当底薪模式为浮动底薪(非华南)时,请设定底薪费率!");
        //    return;
        //}
        if (bll.Model.BasePayMode == 5 && bll.Model["SalesType"] == "0")
        {
            MessageBox.Show(this, "当底薪模式为浮动底薪(华南)时,请设定实销类别!");
            return;
        }
        if (bll.Model.BasePayMode == 5 && bll.Model["BaseFeeRate"] == "0")
        {
            MessageBox.Show(this, "当底薪模式为浮动底薪(华南)时,请设定底薪费率!");
            return;
        }
        #endregion
        bll.Model["ISArriveTarget"] = chk_arrivetarget.Checked ? "1" : "2";
        if ((int)ViewState["PromotorSalaryID"] == 0)
        {
            bll.Model.Promotor    = (int)ViewState["PromotorID"];
            bll.Model.State       = 1;
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = (int)Session["UserID"];

            ViewState["PromotorSalaryID"] = bll.Add();
        }
        else
        {
            bll.Update();
        }

        BindGrid();
        MessageBox.ShowAndRedirect(this, "保存成功!", "PM_PromotorSalaryDetail.aspx?ID=" + ViewState["PromotorSalaryID"].ToString());
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        PM_PromotorBLL _promotor = null;

        if ((int)ViewState["PromotorID"] == 0)
        {
            _promotor = new PM_PromotorBLL();
        }
        else
        {
            _promotor = new PM_PromotorBLL((int)ViewState["PromotorID"]);
        }

        int classify = 0, oldClassify = 0;

        int.TryParse(_promotor.Model["Classfiy"], out oldClassify);
        int oldOrganizeCity = _promotor.Model.OrganizeCity;

        UC_DetailView1.GetData(_promotor.Model);

        #region 判断数据有效性
        if (!(_promotor.Model.OrganizeCity > 1))
        {
            MessageBox.Show(this, "请选择导购员所在的管理片区!");
            return;
        }
        int.TryParse(_promotor.Model["Classfiy"], out classify);
        if (classify == 0)
        {
            MessageBox.Show(this, "请正确选择导购员类别!");
            return;
        }
        if (_promotor.Model["InfoSource"] == "" || _promotor.Model["InfoSource"] == "0")
        {
            MessageBox.Show(this, "请正确选择导购来源!");
            return;
        }
        if (_promotor.Model["OldClassify"] == "" || _promotor.Model["OldClassify"] == "0")
        {
            MessageBox.Show(this, "请正确选择原属品牌!");
            return;
        }
        if (_promotor.Model["BankType"] == "" || _promotor.Model["BankType"] == "0")
        {
            MessageBox.Show(this, "请正确选择银行信息");
            return;
        }
        int bankid = int.Parse(ddl_BankType.SelectedValue);
        if (_promotor.Model["BankName"] == "" || bankid <= 2 && _promotor.Model["BankName"] != ddl_BankType.SelectedItem.Text)
        {
            MessageBox.Show(this, "银行备注信息不正确");
            return;
        }
        //Org_Staff _staffM = new Org_StaffBLL((int)Session["UserID"]).Model;
        //if (_staffM.OrganizeCity == _promotor.Model.OrganizeCity)
        //{
        //    MessageBox.Show(this, "对不起,你不能把导购员放在与你同级的管理片区");
        //    return;
        //}

        #endregion


        #region 判断在职及离职状态
        if (_promotor.Model.Dimission == 1)
        {
            _promotor.Model.EndWorkDate = new DateTime(1900, 1, 1);
        }
        else if (_promotor.Model.EndWorkDate == new DateTime(1900, 1, 1))
        {
            _promotor.Model.EndWorkDate = DateTime.Today;
        }
        #endregion
        #region 如果有工资生成判断离职时间
        if ((int)ViewState["PromotorID"] > 0)
        {
            string[]        allowday  = Addr_OrganizeCityParamBLL.GetValueByType(1, 3).Split(new char[] { ',', ',', ';', ';' });
            AC_AccountMonth lastmonth = GetMaxSalaryDate((int)ViewState["PromotorID"], AC_AccountMonthBLL.GetCurrentMonth() - 1);
            if (lastmonth != null && allowday.Contains(DateTime.Now.Day.ToString()) && _promotor.Model.BeginWorkDate > lastmonth.EndDate)
            {
                MessageBox.Show(this, "该导购在" + lastmonth.Name + "生成过工资,入职日期不能大于" + lastmonth.EndDate.ToString("yyyy-MM-dd"));
                return;
            }
            if (_promotor.Model.Dimission == 2 && _promotor.Model.EndWorkDate < _promotor.Model.BeginWorkDate && _promotor.Model.EndWorkDate.AddDays(40) > DateTime.Now)
            {
                MessageBox.Show(this, "导购离职日期不能小于入职日期!");
                return;
            }
            AC_AccountMonth month = GetMaxSalaryDate((int)ViewState["PromotorID"], 0);
            if (month != null && _promotor.Model.Dimission == 2 && _promotor.Model.EndWorkDate < month.BeginDate)
            {
                MessageBox.Show(this, "该导购在" + month.Name + "生成过工资,离职日期不能小于" + month.BeginDate.ToString("yyyy-MM-dd"));
                return;
            }
        }
        #endregion
        if (_promotor.Model["IDCode"] != string.Empty && _promotor._GetModelList("ID!=" + ViewState["PromotorID"].ToString() + " AND MCS_SYS.dbo.UF_Spilt(PM_Promotor.ExtPropertys,'|',1)='" + _promotor.Model["IDCode"] + "'").Count > 0)
        {
            MessageBox.Show(this, "对不起,该身份证号的导购员已在系统中,请核实后再新增!");
            return;
        }

        if ((int)ViewState["PromotorID"] == 0)
        {
            DateTime birthday;
            if (DateTime.TryParse(_promotor.Model["Birthday"], out birthday))
            {
                if (DateTime.Now < birthday.AddYears(16) || DateTime.Now > birthday.AddYears(50))
                {
                    int year = DateTime.Now.Year - birthday.Year;
                    if (birthday.AddYears(year) > DateTime.Now)
                    {
                        year++;
                    }
                    MessageBox.Show(this, "对不起,该导购年龄不符合规则(16~49岁),该人员年龄:" + year);
                    return;
                }
            }

            if (PM_PromotorNumberLimitBLL.CheckAllowAdd(_promotor.Model.OrganizeCity, classify) <= 0)
            {
                MessageBox.Show(this, "对不起当前城市导购员人数满额,要想继续新增请与人事经理联系");
                return;
            }

            _promotor.Model.InputStaff  = (int)Session["UserID"];
            _promotor.Model.ApproveFlag = 2;
            _promotor.Model.Dimission   = 1;
            _promotor.Model.EndWorkDate = new DateTime(1900, 1, 1);
            ViewState["PromotorID"]     = _promotor.Add();
        }
        else
        {
            if (!PM_PromotorNumberLimitBLL.IsSameLimit(oldOrganizeCity, _promotor.Model.OrganizeCity, oldClassify, classify) &&
                PM_PromotorNumberLimitBLL.CheckAllowAdd(_promotor.Model.OrganizeCity, classify) <= 0)
            {
                MessageBox.Show(this, "对不起当前城市导购员人数满额,要想继续新增请与人事经理联系");
                return;
            }

            _promotor.Model.UpdateStaff = (int)Session["UserID"];
            _promotor.Update();
        }
        if (sender != null)
        {
            Response.Redirect("PM_PromotorDetail.aspx?PromotorID=" + ViewState["PromotorID"].ToString());
        }
    }