Exemplo n.º 1
0
 private void but_Login_Click(object sender, EventArgs e)
 {
     try
     {
         but_Login.Enabled = false;
         Msg.RunInBackground(
             delegate(object obj, DoWorkEventArgs ce)
         {
             if (TB_name.Text.Trim() == "")
             {
                 string msg = "用户名不能为空";
                 errorProvider1.SetError(TB_name, msg);
                 Msg.ShowErrorMsg(msg);
                 TB_name.Focus();
                 return;
             }
             else if (TB_Pwd.Text.Trim() == "")
             {
                 string msg = "密码不能为空";
                 errorProvider1.SetError(TB_Pwd, msg);
                 Msg.ShowErrorMsg(msg);
                 TB_Pwd.Focus();
                 return;
             }
             ClientServicesProxy proxys = new ClientServicesProxy();
             tb_User p = new tb_User {
                 User_Name = TB_name.Text.Trim(), User_Pwd = TB_Pwd.Text.Trim()
             };
             ce.Result = proxys.Find(p).FirstOrDefault();
         },
             delegate(object obj, RunWorkerCompletedEventArgs rce)
         {
             var result = rce.Result as tb_User;
             if (result.IsNotNull() && result.User_Name.IsNotNull() && result.User_Pwd.IsNotNull() && result.User_Name.IsEquals(TB_name.Text.Trim()) && result.User_Pwd.IsEquals(TB_Pwd.Text.Trim()))
             {
                 App.CertificationUser = result;
                 Frm_Main main         = new Frm_Main();
                 Frm_SDXT.pass         = TB_Pwd.Text.Trim();
                 main.Show();
                 this.Hide();
             }
             else
             {
                 string msg = "用户名或密码错误";
                 errorProvider1.SetError(TB_Pwd, msg);
                 Msg.ShowErrorMsg(msg);
                 TB_Pwd.Focus();
                 TB_name.Focus();
             }
         });
     }
     catch (Exception ex)
     {
         Msg.ShowErrorMsg(ex);
     }
     finally
     {
         but_Login.Enabled = true;
     }
 }
Exemplo n.º 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     deskResult.LastOperationTime   = StaticStr.dateTime;
     deskResult.LastOperationUserId = App.CertificationUser.Id;
     if (new ClientServicesProxy().Update(deskResult) > 0)
     {
         if (Frm_Main.RefreshsAction.IsNotNull())
         {
             this.Close();
             Frm_Main.RefreshsAction();
         }
     }
     else
     {
         Msg.ShowOkMsg("保存失败");
     }
 }
Exemplo n.º 3
0
 private void but_OK_Click(object sender, EventArgs e)
 {
     try
     {
         Orders order = new Orders();
         order.Id                  = App.GetGuid;
         order.ShopId              = App.CertificationUser.ShopId;
         order.CreateTime          = App.GetDateTime;
         order.LastOperationTime   = order.CreateTime;
         order.CreateUserId        = App.CertificationUser.Id;
         order.LastOperationUserId = order.CreateUserId;
         order.MemberId            = txtMemberId.Text;
         order.DeskId              = deskResult.Id;
         order.TypeId              = deskTypeResult.Id;
         order.Status              = StatusEnum.True.ToString();
         order.Remarks             = txtRemarks.Text;
         order.CustomerName        = txtCustomerName.Text;
         order.TelePhone           = txtTelePhone.Text;
         order.CustomerNumber      = txtCustomersNumber.Text.ToInt();
         order.FlowStatus          = StatusEnum.Using.ToString();
         if (new ClientServicesProxy().Add(order) > 0)
         {
             if (Frm_Main.RefreshsAction.IsNotNull())
             { //scope.Complete();
                 this.Close();
                 Frm_Main.RefreshsAction();
             }
         }
         else
         {
             Msg.ShowOkMsg("保存失败");
         }
     }
     catch (Exception ex)
     {
         Msg.ShowErrorMsg(ex);
     }
 }