コード例 #1
0
    protected void bt_AddApply_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["PromotorID"] == 0)
        {
            MessageBox.Show(this, "对不起,请您先保存后在发起申请");
            return;
        }
        bt_OK_Click(null, null);

        PM_PromotorBLL bll = new PM_PromotorBLL((int)ViewState["PromotorID"]);
        DateTime       birthday;

        if (DateTime.TryParse(bll.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(bll.Model.OrganizeCity, int.Parse(bll.Model["Classfiy"])) < 0)
        {
            MessageBox.Show(this, "对不起当前城市导购员人数满额,要想继续新增请与人事经理联系");
            return;
        }
        if (bll.Model.BeginWorkDate.AddDays(40) < DateTime.Now)
        {
            MessageBox.Show(this, "对不起,入职时间必须在发起日期前40天之内!");
            return;
        }
        if (bll.Model["IDCode"] == "")
        {
            MessageBox.Show(this, "请录入身份证号!");
            return;
        }
        if (bll.Model["InfoSource"] == "" || bll.Model["InfoSource"] == "0")
        {
            MessageBox.Show(this, "请正确选择导购来源!");
            return;
        }
        if (bll.Model["OldClassify"] == "" || bll.Model["OldClassify"] == "0")
        {
            MessageBox.Show(this, "请正确选择原属品牌!");
            return;
        }
        if (bll.Model["BankType"] == "" || bll.Model["BankType"] == "0")
        {
            MessageBox.Show(this, "请正确选择银行信息");
            return;
        }
        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()) && bll.Model.BeginWorkDate > lastmonth.EndDate)
        {
            MessageBox.Show(this, "该导购在" + lastmonth.Name + "生成过工资,入职日期不能大于" + lastmonth.EndDate.ToString("yyyy-MM-dd"));
            return;
        }

        #region 判断是否KA店导购
        bool IsKAChannel = false;         //是否KA店导购

        if (bll.Model["Classify"] != "2") //非流导
        {
            IList <PM_PromotorInRetailer> retailers = PM_PromotorInRetailerBLL.GetModelList(" Promotor=" + ViewState["PromotorID"].ToString());
            if (retailers.Count == 0)
            {
                MessageBox.Show(this, "对不起,请关联该导购所在的工作门店!");
                return;
            }

            //判断导购是否在KA店工作
            foreach (PM_PromotorInRetailer item in retailers)
            {
                CM_Client client = new CM_ClientBLL(item.Client).Model;
                if (client["RTChannel"] == "1" || client["RTChannel"] == "2")
                {
                    IsKAChannel = true;
                }
            }
        }
        #endregion

        #region 判断是否超薪酬超准
        bool bSalaryFlag = false;   //false : 薪酬标准内 true:超标准
        IList <PM_PromotorSalary> salarylists = PM_PromotorSalaryBLL.GetModelList("Promotor=" + bll.Model.ID.ToString() + " AND State IN(1,3) Order BY State");

        if (salarylists.Count == 0 || salarylists.Count > 0 && (bll.Model["Classfiy"] == "6" && salarylists[0].BasePayMode != 3 || bll.Model["Classfiy"] != "6" && salarylists[0].BasePayMode == 3))
        {
            MessageBox.Show(this, "对不起,尚未为该导购设定薪酬信息,请设定完薪酬信息后,再提交入职申请!");
            return;
        }
        else
        {
            PM_PromotorSalary salary = salarylists[0];
            if (salary.BasePaySubsidy > 0)
            {
                bSalaryFlag = true;                              //有底薪补贴
            }
            if (salary.MinimumWageMode == 2)
            {
                bSalaryFlag = true;                              //特殊保底
            }
            if (salary.InsuranceMode == 1 && salary.InsuranceSubsidy > 100)
            {
                bSalaryFlag = true;                                                                 //社保补贴大于100元的
            }
        }
        #endregion

        int budget = PM_PromotorNumberLimitBLL.CheckOverBudget(bll.Model.OrganizeCity, int.Parse(bll.Model["Classfiy"]));

        NameValueCollection dataobjects = new NameValueCollection();
        dataobjects.Add("ID", ViewState["PromotorID"].ToString());
        dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString());
        dataobjects.Add("SalaryFlag", !bSalaryFlag ? "1" : "2");      //薪酬标志 1:薪酬标准内 2:薪酬标准外
        dataobjects.Add("StaffName", bll.Model.Name.ToString());
        dataobjects.Add("IsKAChannel", IsKAChannel ? "1" : "2");      //是否KA卖场的导购
        dataobjects.Add("IsOverBudget", budget < 0 ? "1" : "2");      //是否超人数预算 1:超 2:未超


        int TaskID = EWF_TaskBLL.NewTask("Add_Promotor", (int)Session["UserID"], "新增导购员流程,姓名:" + bll.Model.Name + "【" + ddl_Classify.SelectedItem.Text.ToString() + "】", "~/SubModule/PM/PM_PromotorDetail.aspx?PromotorID=" + ViewState["PromotorID"].ToString(), dataobjects);
        if (TaskID > 0)
        {
            bll.Submit(TaskID, (int)Session["UserID"]);
        }

        Response.Redirect("~/SubModule/EWF/Apply.aspx?TaskID=" + TaskID.ToString());
    }
コード例 #2
0
    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, "流程发起成功!");
            }
        }
    }
コード例 #3
0
    private void BindData()
    {
        PM_Promotor m = new PM_PromotorBLL((int)ViewState["PromotorID"]).Model;

        UC_DetailView1.BindData(m);
        gv_list.ConditionString = " Promotor= " + (int)ViewState["PromotorID"];
        gv_list.BindGrid();

        //验证身份证号码
        txt_BankName.Enabled = m["BankType"] == "3";

        if (m.ApproveFlag == 1)
        {
            bt_Approve.Visible = false;
            if (m.Dimission == 1)
            {
                TextBox txt_EndWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_EndWorkDate");
                if (txt_EndWorkDate != null)
                {
                    txt_EndWorkDate.Enabled = false;
                }

                bt_AddApply.Visible = false;
                #region 导购兼职/专职转换
                int classfiy = 0;
                int.TryParse(m["Classfiy"], out classfiy);
                if (classfiy == 0)
                {
                    bt_ChangeClassify.Visible = false;
                }
                else if (classfiy == 1 || classfiy == 2)
                {
                    bt_ChangeClassify.Text    = "转为兼职";
                    bt_ChangeClassify.Visible = true;
                }
                else
                {
                    bt_ChangeClassify.Text    = "转为专职/流动";
                    bt_ChangeClassify.Visible = true;
                }
                bt_ChangeClassify.OnClientClick = "PopPMClassify_Approve(" + ViewState["PromotorID"].ToString() + ")";
                #endregion
            }
            Header.Attributes["WebPageSubCode"] = "Modify";
            //TextBox txt_BeginWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_BeginWorkDate");

            //临时开放修改功能
            //if (txt_BeginWorkDate != null && m.Dimission==1) txt_BeginWorkDate.Enabled = false;

            //有些离职日期会填写错误,更新为权限修改 12.11.21
            //if (m.Dimission == 2)
            //{
            //    TextBox txt_EndWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_EndWorkDate");
            //    if (txt_EndWorkDate != null) txt_EndWorkDate.Enabled = false;
            //}
            string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 9).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
            if (allowdays.Contains(DateTime.Now.Day.ToString()))
            {
                bt_ChangeClassify.Enabled = false;
                bt_ChangeClassify.ToolTip = "导购工资生成期间不能互转";
            }
        }

        if (m["State"] == "2")
        {
            //审批中
            bt_AddApply.Visible       = false;
            bt_OK.Visible             = false;
            bt_TaskDetail.Visible     = true;
            bt_ChangeClassify.Enabled = false;
            bt_ChangeClassify.ToolTip = "该导购有未完成的流程,请待流程完成后,再做调整!";
        }
        bt_OK.Text      = "保 存";
        bt_OK.ForeColor = System.Drawing.Color.Red;


        if (m["Classfiy"] != "")
        {
            int budget = PM_PromotorNumberLimitBLL.CheckOverBudget(m.OrganizeCity, int.Parse(m["Classfiy"]));
            if (budget == 0)
            {
                lb_OverBudgetInfo.Text = "导购员数量已等于预定的预算人数,请注意!";
            }
            else if (budget < 0)
            {
                lb_OverBudgetInfo.Text = "导购员数量已超过预定的预算人数 " + (0 - budget).ToString() + "人,请注意!";
            }
        }


        if (m["IDCode"].Length == 18 && !Tools.DoVerifyIDCode(m["IDCode"]))
        {
            lb_OverBudgetInfo.Text += "         注意:该导购员身份证号码错误!";
        }

        ddl_Classify_SelectedIndexChanged(null, null);
    }