コード例 #1
0
    private void InitModule()
    {
        if (Request["ID"] == null)
        {
            return;
        }

        int id = int.Parse(Request["ID"].ToString());

        txtID.Text = id.ToString();
        FineOffice.Modules.HR_Personnel model = personnelBll.GetModel(d => d.ID == id);
        txtAddress.Text             = model.Address;
        calDateOfBirth.SelectedDate = model.DateOfBirth;
        ddlDepartment.SelectedValue = model.DepartmentID.ToString();
        ddlEducation.SelectedValue  = model.EducationID.ToString();
        txtEmail.Text             = model.Email;
        calEntryDate.SelectedDate = model.EntryDate;
        calExitDate.SelectedDate  = model.ExitDate;
        txtHomeTelephone.Text     = model.HomeTelephone;
        ddlJob.SelectedValue      = model.JobID.ToString();
        txtLinkman.Text           = model.Linkman;
        txtMobile.Text            = model.Mobile;
        txtName.Text         = model.Name;
        txtNativePlace.Text  = model.NativePlace;
        txtPersonnelNO.Text  = model.PersonnelNO;
        txtPinyin.Text       = model.PinyinCode;
        ddlSex.SelectedValue = model.Sex.ToString();
        chkStop.Checked      = model.Stop.Value;
        txtRemark.Text       = model.Remark;
        chkStop.Checked      = model.Stop.Value;
    }
コード例 #2
0
    /// <summary>
    /// 右移
    /// </summary>
    protected void btnRight_Click(object sender, EventArgs e)
    {
        List <FineOffice.Modules.HR_Personnel> personnelList = new List <FineOffice.Modules.HR_Personnel>();

        int[]           keys = personGrid.SelectedRowIndexArray;
        List <object[]> list = new List <object[]>();

        for (int i = 0; i < keys.Length; i++)
        {
            list.Add(personGrid.DataKeys[keys[i]]);
        }
        List <object[]> selected = rightGrid.DataKeys;

        for (int i = 0; i < selected.Count; i++)
        {
            personnelList.Add(new FineOffice.Modules.HR_Personnel
            {
                ID   = int.Parse(selected[i][0].ToString()),
                Name = selected[i][1].ToString()
            });
        }

        #region 判断右边的Grid是否已含员工信息
        for (int i = 0; i < list.Count; i++)
        {
            bool contains = false;
            for (int j = 0; j < selected.Count; j++)
            {
                if (list[i][0].Equals(selected[j][0]))
                {
                    contains = true;
                    break;
                }
            }
            if (!contains)
            {
                FineOffice.Modules.HR_Personnel personnel = new FineOffice.Modules.HR_Personnel
                {
                    ID   = int.Parse(list[i][0].ToString()),
                    Name = list[i][1].ToString()
                };
                personnelList.Add(personnel);
            }
        }
        #endregion

        rightGrid.DataSource = personnelList;
        rightGrid.DataBind();
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
            this.personGrid.PageIndex = 0;
            ChangeTrackingList <EntitySearcher> changeTrackingList = new ChangeTrackingList <EntitySearcher>();
            ViewState["sql"] = changeTrackingList;
            GridColumn column = personGrid.FindColumn(personGrid.SortColumn);
            ExtBindingList <FineOffice.Modules.HR_Personnel> list = personGrid_Bind(changeTrackingList, column.SortField, personGrid.SortDirection);

            #region 恢复选中
            if (Request["selected"] != null && Request["selected"].Length > 0)
            {
                List <FineOffice.Modules.HR_Personnel> tempList = new List <FineOffice.Modules.HR_Personnel>();
                string[] str = Request["selected"].Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    if (str[i].Length > 0)
                    {
                        FineOffice.Modules.HR_Personnel depart = list.Where(d => d.ID == int.Parse(str[i])).FirstOrDefault();
                        tempList.Add(depart);
                    }
                }
                rightGrid.DataSource = tempList;
                rightGrid.DataBind();
            }
            #endregion

            btnNew.OnClientClick = newPersonWin.GetShowReference();


            btnModify.OnClientClick = personGrid.GetNoSelectionAlertReference(string.Format("请选择要编辑的{0}!", personGrid.Title));
            btnDelete.OnClientClick = personGrid.GetNoSelectionAlertReference(string.Format("请选择要删除的{0}!", personGrid.Title));
            btnDelete.ConfirmText   = string.Format("你确认要删除选中{0}吗!", personGrid.Title);
        }
        if (Request.Form["__EVENTARGUMENT"] == "subwin_close")
        {
            ChangeTrackingList <EntitySearcher> changeTrackingList = ViewState["sql"] as ChangeTrackingList <EntitySearcher>;
            GridColumn column = personGrid.FindColumn(personGrid.SortColumn);
            personGrid_Bind(changeTrackingList, column.SortField, personGrid.SortDirection);
        }
    }
コード例 #4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     FineOffice.Modules.HR_Personnel model = new FineOffice.Modules.HR_Personnel();
     model.Address     = txtAddress.Text.Trim();
     model.DateOfBirth = calDateOfBirth.SelectedDate;
     if (ddlDepartment.SelectedValue.Length > 0)
     {
         model.DepartmentID = int.Parse(ddlDepartment.SelectedValue);
     }
     if (ddlEducation.SelectedValue.Length > 0)
     {
         model.EducationID = int.Parse(ddlEducation.SelectedValue);
     }
     model.Email         = txtEmail.Text;
     model.EntryDate     = calEntryDate.SelectedDate;
     model.ExitDate      = calExitDate.SelectedDate;
     model.HomeTelephone = txtHomeTelephone.Text.Trim();
     if (ddlJob.SelectedValue.Length > 0)
     {
         model.JobID = int.Parse(ddlJob.SelectedValue);
     }
     model.Linkman     = txtLinkman.Text.Trim();
     model.Mobile      = txtMobile.Text.Trim();
     model.Name        = txtName.Text.Trim();
     model.NativePlace = txtNativePlace.Text.Trim();
     model.PersonnelNO = txtPersonnelNO.Text.Trim();
     model.PinyinCode  = txtPinyin.Text.Trim();
     model.Sex         = short.Parse(ddlSex.SelectedValue);
     model.Stop        = chkStop.Checked;
     model.Remark      = txtRemark.Text.Trim();
     try
     {
         personnelBll.Add(model);
         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close"));
     }
     catch (Exception ex)
     {
         Alert.ShowInParent(ex.Message);
     }
 }
コード例 #5
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        btnLogin.Visible = false;
        string valiString = txtCaptcha.Text.Trim();

        FineOffice.Modules.SYS_User model = new FineOffice.Modules.SYS_User();
        model.UserName = txtUserName.Text.Trim();
        model.Password = this.txtPassword.Text.Trim();

        if (HttpContext.Current.Session["IdentifyingCode"] == null)
        {
            lblValrUser.Text = "验证码异常,请重新输入!";
            InitCaptchaCode();
            return;
        }
        if (String.Compare(HttpContext.Current.Session["IdentifyingCode"].ToString(), valiString, true) != 0)
        {
            lblValrUser.Text = "验证码错误!";
            return;
        }
        string pwd = FineOffice.Common.DEncrypt.DESEncrypt.Encrypt(model.Password);

        FineOffice.Modules.SYS_User temp = userBll.GetModel(u => u.UserName == model.UserName && u.Password == pwd);
        if (temp == null)
        {
            lblValrUser.Text = "用户名或密码错误!";
            btnLogin.Visible = true;
            return;
        }
        else
        {
            this.CookieUser           = temp;
            this.SessionMenuList      = this.GetMenuList(temp);
            this.SessionAuthorityList = this.GetAuthorityList(temp);

            FineOffice.Modules.HR_Personnel personnel = personnelBll.GetModel(p => p.ID == temp.PersonnelID);
            this.CookiePersonnel = personnel;
            Response.Redirect("Main.aspx");
        }
    }