Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (base.Request["Code"] != null)
                {
                    ddlUser.Visible     = false;
                    btnSelect.Visible   = false;
                    this.btnAdd.Visible = false;
                    HR_PERSON model = this.perSer.GetModel(Convert.ToInt32(base.Request["Code"]));

                    this.txtCode.Text       = model.Code;
                    this.txtDepartment.Text = model.Department;
                    this.txtPosition.Text   = model.Position;
                    this.txtName.Text       = model.Name;
                    if (model.Birthday != null)
                    {
                        this.txtBirthday.Text = model.Birthday.Value.ToShortDateString();
                    }
                    this.ddlSex.Text             = model.Sex;
                    this.txtEducationLevel.Text  = model.EducationLevel;
                    this.txtEducationSchool.Text = model.EducationSchool;
                    this.txtMajor.Text           = model.Major;
                    if (model.GraduationTime != null)
                    {
                        this.txtGraduationTime.Text = model.GraduationTime.Value.ToShortDateString();
                    }
                    if (model.OnBoardTime != null)
                    {
                        this.txtOnBoardTime.Text = model.OnBoardTime.Value.ToShortDateString();
                    }
                    if (model.BeNormalTime != null)
                    {
                        this.txtBeNormalTime.Text = model.BeNormalTime.Value.ToShortDateString();
                    }
                    if (model.ContractTime != null)
                    {
                        this.txtContractTime.Text = model.ContractTime.Value.ToShortDateString();
                    }
                    if (model.ContractCloseTime != null)
                    {
                        this.txtContractCloseTime.Text = model.ContractCloseTime.Value.ToShortDateString();
                    }
                    this.txtHuKou.Text        = model.HuKou;
                    this.ddlMarriage.Text     = model.Marriage;
                    this.txtIDCard.Text       = model.IDCard;
                    this.txtMobilePhone.Text  = model.MobilePhone;
                    this.txtHomePhone.Text    = model.HomePhone;
                    this.txtHomeAddress.Text  = model.HomeAddress;
                    this.txtEmailAddress.Text = model.EmailAddress;
                    if (model.CreateTime != null)
                    {
                        this.txtCreateTime.Text = model.CreateTime.ToString();
                    }
                    this.txtCreatePerson.Text = model.CreatePerson.ToString();
                    if (model.UpdateTime != null)
                    {
                        this.txtUpdateTime.Text = model.UpdateTime.ToString();
                    }
                    this.txtUpdatePerson.Text = model.UpdatePerson.ToString();
                    this.chkQuit.Checked      = bool.Parse(model.Quit.ToString());

                    System.Collections.Generic.List <string> perss = perSer.GetCreateUpdateInfo(Convert.ToInt32(base.Request["Code"]));
                    txtCreatePerson.Text = perss[0];
                    txtUpdatePerson.Text = perss[1];
                }
                else
                {
                    VAN_OA.Dal.SysUserService userSer = new VAN_OA.Dal.SysUserService();
                    List <VAN_OA.Model.User>  user    = userSer.getAllUserByLoginName(" And loginStatus='在职'");
                    ddlUser.DataSource = user;
                    ddlUser.DataBind();
                    ddlUser.DataTextField  = "LoginName";
                    ddlUser.DataValueField = "Id";
                    this.btnUpdate.Visible = false;
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                lbtnSelectPONo.Visible = false;
                //请假单子
                VAN_OA.Dal.SysUserService userSer = new VAN_OA.Dal.SysUserService();
                List <VAN_OA.Model.User>  user    = userSer.getAllUserByLoginName("");
                ddlUser.DataSource = user;
                ddlUser.DataBind();
                ddlUser.DataTextField  = "LoginName";
                ddlUser.DataValueField = "LoginName";

                if (base.Request["ProId"] != null)
                {
                    txtAppDate.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    //加载基本数据
                    VAN_OA.Model.User use = Session["userInfo"] as VAN_OA.Model.User;
                    txtName.Text = use.LoginName;

                    txtDepartName.Text = use.LoginIPosition;

                    tb_EFormService eformSer = new tb_EFormService();
                    if (Request["allE_id"] == null)//单据增加
                    {
                        lbtnSelectPONo.Visible = true;
                        txtTotal.ReadOnly      = true;
                        lblGuestName.Visible   = false;
                        ddlUser.Visible        = false;
                        lblPer.Text            = "客户代表:";
                        //检查自己是否在请假单中流程设置中,来确定自己下一个审批人

                        lblResult.Visible       = false;
                        lblYiJian.Visible       = false;
                        ddlResult.Visible       = false;
                        txtResultRemark.Visible = false;


                        if (eformSer.ifHasNodes(Convert.ToInt32(Request["ProId"])))
                        {
                            //获取审批人

                            int ids = 0;
                            List <A_Role_User> roleUserList = eformSer.getUsers(0, Convert.ToInt32(Request["ProId"]), out ids);


                            ViewState["ids"] = ids;
                            if (roleUserList != null)
                            {
                                ddlPers.DataSource = roleUserList;
                                ddlPers.DataBind();
                                ddlPers.DataTextField  = "UserName";
                                ddlPers.DataValueField = "UserId";
                            }
                            else
                            {
                                lblPer.Visible  = false;
                                ddlPers.Visible = false;
                            }
                        }
                        else
                        {
                            lblPer.Visible  = false;
                            ddlPers.Visible = false;
                        }
                    }
                    else//单据审批
                    {
                        //加载已经审批的数据
                        tb_EFormsService eformsSer = new tb_EFormsService();
                        List <VAN_OA.Model.EFrom.tb_EForms> eforms = eformsSer.GetListArray(string.Format(" e_Id in (select id from tb_EForm where proId={0} and allE_id={1})",
                                                                                                          Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                        if (eforms.Count > 0)
                        {
                            string mess = @"<table cellpadding='0' cellspacing='0' width='100%' bordercolorlight='#999999' bordercolordark='#FFFFFF' border='1' ><tr><td colspan='6' style=' height:20px; background-color:#336699; color:White;'>流程图</td></tr>";


                            for (int i = 0; i < eforms.Count; i++)
                            {
                                string per = "";
                                if (eforms[i].consignor != null && eforms[i].consignor != 0)
                                {
                                    per = eforms[i].Consignor_Name + "(委托人:" + eforms[i].Audper_Name + ")";
                                }
                                else
                                {
                                    per = eforms[i].Audper_Name;
                                }
                                mess += string.Format("<tr><td align='center'>第{0}步</td><td>序号{0}:{1}</td><td><span style='color:red;'>{2}</span>[<span style='color:blue;'>{3} {4}</span>]<br/>意见:{5}</td></tr>",
                                                      i + 1, eforms[i].RoleName
                                                      , per, eforms[i].resultState, eforms[i].doTime, eforms[i].idea);
                            }
                            mess        += "</table>";
                            lblMess.Text = mess;
                        }

                        #region  加载 请假单数据
                        tb_OverTimeSerivce timeSer = new tb_OverTimeSerivce();

                        tb_OverTime timeModel = timeSer.GetModel(Convert.ToInt32(Request["allE_id"]));
                        txtDepartName.Text = timeModel.DepartName;
                        txtForm.Text       = timeModel.formTime.ToString();
                        txtName.Text       = timeModel.LoginName;
                        ddlUser.Text       = timeModel.guestDai;
                        txtTo.Text         = timeModel.toTime.ToString();
                        txtreason.Text     = timeModel.reason;

                        //txtSuiXingRen.Text = timeModel.SuixingRen;
                        txtAddress.Text = timeModel.Address;
                        //txtTime.Text = timeModel.Time.Value.ToShortDateString();
                        lblProNo.Text = timeModel.ProNo;
                        if (timeModel.Total != null)
                        {
                            txtTotal.Text = timeModel.Total.ToString();
                        }

                        if (timeModel.OverTimeType != null)
                        {
                            ddlOverTimeType.Text = timeModel.OverTimeType;
                        }

                        txtPOGuestName.Text = timeModel.POGuestName;
                        txtPOName.Text      = timeModel.POName;
                        txtPONo.Text        = timeModel.PONo;

                        showTimeSpan();
                        if (timeModel.Time.HasValue)
                        {
                            txtAppDate.Text = timeModel.Time.Value.ToString("yyyy-MM-dd hh:mm:ss");
                        }
                        #endregion
                        //判断单据是否已经结束
                        if (eformSer.ifFinish(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                        {
                            btnSub.Visible          = false;
                            lblPer.Visible          = false;
                            ddlPers.Visible         = false;
                            lblResult.Visible       = false;
                            lblYiJian.Visible       = false;
                            ddlResult.Visible       = false;
                            txtResultRemark.Visible = false;
                            setEnable(false);
                        }
                        else
                        {
                            //是否为审核人
                            if (eformSer.ifAudiPer(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                            {
                                if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                {
                                    lblPer.Visible  = false;
                                    ddlPers.Visible = false;
                                }
                                else
                                {
                                    int ids = 0;

                                    List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids);

                                    ViewState["ids"] = ids;
                                    if (roleUserList != null)
                                    {
                                        ddlPers.DataSource = roleUserList;
                                        ddlPers.DataBind();
                                        ddlPers.DataTextField  = "UserName";
                                        ddlPers.DataValueField = "UserId";
                                    }
                                    setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                }
                            }
                            else
                            {
                                //是否为代理人
                                if (eformSer.ifAudiPerByUserName(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                {
                                    ViewState["ifConsignor"] = true;
                                    if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])))
                                    {
                                        lblPer.Visible  = false;
                                        ddlPers.Visible = false;
                                    }
                                    else
                                    {
                                        int ids = 0;
                                        List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids);
                                        ViewState["ids"] = ids;
                                        if (roleUserList != null)
                                        {
                                            ddlPers.DataSource = roleUserList;
                                            ddlPers.DataBind();
                                            ddlPers.DataTextField  = "UserName";
                                            ddlPers.DataValueField = "UserId";
                                        }
                                        setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])));
                                    }
                                }
                                else
                                {
                                    btnSub.Visible  = false;
                                    lblPer.Visible  = false;
                                    ddlPers.Visible = false;

                                    lblResult.Visible       = false;
                                    lblYiJian.Visible       = false;
                                    ddlResult.Visible       = false;
                                    txtResultRemark.Visible = false;
                                    setEnable(false);
                                }
                            }
                        }
                    }
                }
            }
        }