Exemplo n.º 1
0
        /// <summary>
        /// 获取已认证并登记进微信企业号中的人员数。
        /// </summary>
        /// <returns></returns>
        //public int GetIsQYUser_Sum()
        //{
        //    return dbContext.Stuff.Where(o => o.IsQYUser == true).Count();
        //}

        #endregion

        public YC.SQLServerDAL.Stuff NewStuff(YC.SQLServerDAL.Stuff user)
        {
            if (user != null)
            {
                if (!ExistUser(user.JobNumber))
                {
                    user.SId = Guid.NewGuid();
                    dbContext.Stuff.InsertOnSubmit(user);
                    dbContext.SubmitChanges();
                }
            }
            return(user);
        }
Exemplo n.º 2
0
    protected void formView_ItemCommand(object sender, FormViewCommandEventArgs e)
    {
        Guid wxgId = Guid.Empty;

        Guid.TryParse(hfSId.Value, out wxgId);

        if (e.CommandName == "UpdateStuff")
        {
            YC.SQLServerDAL.Stuff record = bll_StuffManage.GetStuffById(wxgId);

            // 工号
            TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox;
            record.JobNumber = tbJobNumber.Text;

            // 姓名
            TextBox tbRealName = formView.FindControl("tbRealName") as TextBox;
            record.RealName = tbRealName.Text;

            // 手机号码
            TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox;
            record.MobilePhone = tbMobilePhone.Text;

            // 手机短号
            TextBox tbMobileShort = formView.FindControl("tbMobileShort") as TextBox;
            record.MobileShort = tbMobileShort.Text;

            bll_StuffManage.UpdateStuff(record);
            if (Updated != null)
            {
                Updated(this, new EventArgs());
            }
        }

        if (e.CommandName == "InsertStuff")
        {
            YC.SQLServerDAL.Stuff record = new YC.SQLServerDAL.Stuff();

            // 工号
            TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox;
            record.JobNumber = tbJobNumber.Text;

            // 姓名
            TextBox tbRealName = formView.FindControl("tbRealName") as TextBox;
            record.RealName = tbRealName.Text;

            // 手机号码
            TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox;
            record.MobilePhone = tbMobilePhone.Text;

            // 手机短号
            TextBox tbMobileShort = formView.FindControl("tbMobileShort") as TextBox;
            record.MobileShort = tbMobileShort.Text;

            YC.SQLServerDAL.Stuff user = bll_StuffManage.NewStuff(record);
            if (StuffCreated != null)
            {
                hfSId.Value = user.SId.ToString();
                StuffInsertedEventArgs args = new StuffInsertedEventArgs(user);
                StuffCreated(this, args);
            }
        }

        if (e.CommandName == "DeleteStuff")
        {
            bll_StuffManage.DeleteStuff(wxgId);
            if (Deleted != null)
            {
                Deleted(this, new EventArgs());
            }
        }

        if (e.CommandName == "CancelUpdate" || e.CommandName == "CancelInsert")
        {
            if (Canceled != null)
            {
                Canceled(this, new EventArgs());
            }
        }
    }
Exemplo n.º 3
0
 public StuffInsertedEventArgs(YC.SQLServerDAL.Stuff user)
 {
     this._user = user;
 }
Exemplo n.º 4
0
 public void UpdateStuff(YC.SQLServerDAL.Stuff userinfo)
 {
     dbContext.SubmitChanges();
 }