Exemplo n.º 1
0
Arquivo: UserFrm.cs Projeto: xlgwr/hr
 void initToTxt(user_mstr model)
 {
     txt0UserID.Text   = model.userID;
     txt1UserName.Text = model.name;
     txt2Email.Text    = model.email;
     txt3PassWd.Text   = model.password;
 }
Exemplo n.º 2
0
 private static void CtxAsNull()
 {
     try
     {
         Console.WriteLine("CtxAsNull");
         FakeContext ctx    = null;
         user_mstr   vwUser = ctx.user_mstr.FirstOrDefault(x => x.user_cd == strUserCD);
     }
     catch (NullReferenceException e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine();
     }
 }
Exemplo n.º 3
0
 private static void FirstUserAsNull()
 {
     try
     {
         Console.WriteLine("OneUserAsNull");
         FakeContext ctx = new FakeContext();
         ctx.user_mstr = new List <user_mstr>()
         {
             null, new user_mstr(), new user_mstr()
         };
         user_mstr vwUser = ctx.user_mstr.FirstOrDefault(x => x.user_cd == strUserCD);
     }
     catch (NullReferenceException e)
     {
         Console.WriteLine(e.Message);
     }
     catch (ArgumentNullException e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine();
     }
 }
Exemplo n.º 4
0
 partial void Deleteuser_mstr(user_mstr instance);
Exemplo n.º 5
0
 partial void Updateuser_mstr(user_mstr instance);
Exemplo n.º 6
0
 partial void Insertuser_mstr(user_mstr instance);
Exemplo n.º 7
0
Arquivo: UserFrm.cs Projeto: xlgwr/hr
        private void btn0Save_Click(object sender, EventArgs e)
        {
            try
            {
                #region  checkthat
                if (!initChectTXT())
                {
                    return;
                }

                //check exist
                var tmpUserIDexit = _hrzip.user_mstr.Where(p => p.userID.Equals(txt0UserID.Text.Trim())).SingleOrDefault();

                if (tmpUserIDexit != null)
                {
                    txt0UserID.Focus();
                    tool0Msg.Text = txt0UserID.Text + " 已使用...(Error 1)";
                    return;
                }
                var tmpEmailexit = _hrzip.user_mstr.Where(p => p.email.Equals(txt2Email.Text.Trim())).SingleOrDefault();

                if (tmpEmailexit != null)
                {
                    txt2Email.Focus();
                    tool0Msg.Text = txt2Email.Text + " 已使用...(Error 2)";
                    return;
                }

                #endregion
                this.Invoke(new Action(delegate()
                {
                    tool0Msg.Text = "保存中...";
                }));

                btn0Save.Enabled = false;
                user_mstr tmpusermstr = new user_mstr();
                var       tmpcount    = _hrzip.user_mstr.Count();
                if (tmpcount <= 0)
                {
                    tmpusermstr.Tid = 1;
                }
                else
                {
                    tmpusermstr.Tid = _hrzip.user_mstr.Max(p => p.Tid) + 1;
                }
                tmpusermstr.comp     = "WEC";
                tmpusermstr.userID   = txt0UserID.Text.Trim();
                tmpusermstr.name     = txt1UserName.Text.Trim();
                tmpusermstr.email    = txt2Email.Text.Trim();
                tmpusermstr.password = txt3PassWd.Text.Trim();

                tmpusermstr.clientIP   = apisharp.getClientIP();
                tmpusermstr.updateDate = DateTime.Now;
                _hrzip.user_mstr.Add(tmpusermstr);
                var saveflag = _hrzip.SaveChanges();

                this.Invoke(new Action(delegate()
                {
                    if (saveflag > 0)
                    {
                        txt6SearchByUserID.Text = txt0UserID.Text.Trim();
                        btn0Search_Click(sender, e);
                        tool0Msg.Text = "Save Success: " + txt0UserID.Text;
                    }
                    else
                    {
                        tool0Msg.Text = "Save fail: " + txt0UserID.Text;;
                    }
                }));
                btn0Save.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                tool0Msg.Text    = ex.Message;
                btn0Save.Enabled = true;
            }
        }