示例#1
0
 private void btnNext_Press(object sender, EventArgs e)
 {
     try
     {
         String UserID = txtID.Text.Trim();
         if (isForgetPwd == false)
         {
             if (UserID.Length < 0)
             {
                 throw new Exception("请输入账号!");
             }
             if (UserID.Length < 6 || UserID.Length > 18)
             {
                 throw new Exception("账号必须为6-18位!");
             }
         }
         String pwd = txtPwd.Text.Trim();
         if (pwd.Length <= 0)
         {
             throw new Exception("请输入密码!");
         }
         if (pwd.Length < 6 || pwd.Length > 12)
         {
             throw new Exception("密码必须为6-12位!");
         }
         if (isForgetPwd)    //忘记密码,手机验证
         {
             coreUser coreUser = autofacConfig.coreUserService.GetUserByID(UserID);
             if (coreUser != null)
             {
                 String     OldPwd = coreUser.USER_PASSWORD;
                 ReturnInfo RInfo  = autofacConfig.coreUserService.ChangePwd(UserID, OldPwd, pwd);
                 if (RInfo.IsSuccess)
                 {
                     ReturnInfo result = autofacConfig.coreUserService.Login(UserID, pwd);
                     if (result.IsSuccess)
                     {
                         String Role = autofacConfig.coreUserService.GetUserByID(UserID).USER_ROLE;
                         Client.Session["UserID"] = UserID;
                         Client.Session["Role"]   = Role;
                         frmAssets frm = new frmAssets();
                         Show(frm);
                     }
                     else
                     {
                         throw new Exception(result.ErrorInfo);
                     }
                 }
             }
             else
             {
                 throw new Exception("未找到该用户!");
             }
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
示例#2
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogon_Click(object sender, EventArgs e)
        {
            try
            {
                String userID   = txtUserName.Text.Trim();
                String PassWord = txtPassWord.Text.Trim();
                if (userID.Length <= 0)
                {
                    throw new Exception("请输入用户名");
                }
                if (PassWord.Length <= 0)
                {
                    throw new Exception("请输入密码");
                }
                LoadClientData(MobileServer.ServerID + "user", userID);
                if (checkRemb.Checked == true)
                {
                    //记住密码
                    LoadClientData(MobileServer.ServerID + "pwd", PassWord);
                }
                else
                {
                    //删除客户端数据
                    RemoveClientData(MobileServer.ServerID + "pwd", (object s, ClientDataResultHandlerArgs args) => txtPassWord.Text = "");
                }

                ReturnInfo result = autofacConfig.coreUserService.Login(userID, PassWord);

                if (result.IsSuccess)
                {
                    //MessageBox.Show("正确");
                    String Role = autofacConfig.coreUserService.GetUserByID(userID).permission;
                    Client.Session["local_username"] = userID;
                    Client.Session["permission"]     = Role;
                    frmAssets frm = new frmAssets();
                    Show(frm);
                }
                else
                {
                    //MessageBox.Show("不正确");
                    throw new Exception(result.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 怬
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogon_Click(object sender, EventArgs e)
        {
            try
            {
                String userID   = txtUserName.Text.Trim();
                String PassWord = txtPassWord.Text.Trim();
                if (userID.Length <= 0)
                {
                    throw new Exception("ÇëÊäÈëÊÖ»úºÅÂë");
                }
                if (PassWord.Length < 0)
                {
                    throw new Exception("ÇëÊäÈëÃÜÂë");
                }
                LoadClientData(MobileServer.ServerID + "user", userID);
                if (checkRemb.Checked == true)
                {
                    //¼ÇסÃÜÂë
                    LoadClientData(MobileServer.ServerID + "pwd", PassWord);
                }
                else
                {
                    //ɾ³ý¿Í»§¶ËÊý¾Ý
                    RemoveClientData(MobileServer.ServerID + "pwd", (object s, ClientDataResultHandlerArgs args) => txtPassWord.Text = "");
                }
                ReturnInfo result = autofacConfig.coreUserService.Login(userID, PassWord);

                if (result.IsSuccess)
                {
                    String Role = autofacConfig.coreUserService.GetUserByID(userID).USER_ROLE;
                    Client.Session["UserID"] = userID;
                    Client.Session["Role"]   = Role;
                    frmAssets frm = new frmAssets();
                    Show(frm);
                }
                else
                {
                    throw new Exception(result.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
示例#4
0
        private AutofacConfig _autofacConfig = new AutofacConfig();//调用配置类

        private void touchPanel1_Press(object sender, EventArgs e)
        {
            try
            {
                frmAssetsDetail detail = new frmAssetsDetail();
                detail.AssId = lblID.BindDataValue.ToString();
                Form.Show(detail, (MobileForm sender1, object args) =>
                {
                    if (detail.ShowResult == ShowResult.Yes)
                    {
                        frmAssets assets = (frmAssets)Form;
                        assets.Bind();
                    }
                }
                          );
//                Form.Show(detail);
            }
            catch (Exception ex)
            {
                Parent.Form.Toast(ex.Message);
            }
        }
示例#5
0
        /// <summary>
        /// DemoÕ˺ŵǼ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDemo_Press(object sender, EventArgs e)
        {
            try
            {
                ReturnInfo result = autofacConfig.coreUserService.Login("12345678917", "123456");

                if (result.IsSuccess)
                {
                    String Role = autofacConfig.coreUserService.GetUserByID("12345678917").USER_ROLE;
                    Client.Session["UserID"] = "12345678917";
                    Client.Session["Role"]   = Role;
                    frmAssets frm = new frmAssets();
                    Show(frm);
                }
                else
                {
                    throw new Exception(result.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
示例#6
0
        /// <summary>
        /// 跳转到资产列表界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SNAssets_Press(object sender, EventArgs e)
        {
            frmAssets frm = new frmAssets();

            Form.Show(frm);
        }
示例#7
0
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Press(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text.Trim().Length < 0)
                {
                    throw new Exception("请输入昵称");
                }
                String pwd1 = txtPwd1.Text.Trim();
                String pwd2 = txtPwd2.Text.Trim();
                if (pwd1.Length <= 0)
                {
                    throw new Exception("请输入新密码!");
                }
                if (pwd1.Length < 6 || pwd1.Length > 12)
                {
                    throw new Exception("新密码必须为6-12位!");
                }
                if (pwd2.Length <= 0)
                {
                    throw new Exception("请输入确认密码!");
                }
                if (pwd2.Length < 6 || pwd2.Length > 12)
                {
                    throw new Exception("新密码必须为6-12位!");
                }
                if (pwd1.Equals(pwd2) == false)
                {
                    throw new Exception("两次密码输入不一致,请检查!");
                }
                if (String.IsNullOrEmpty(radioGroup1.CheckedButton.Value))
                {
                    throw new Exception("请选择角色!");
                }
                if (radioGroup1.CheckedButton.Value != "ADMIN")     //用户必须选择区域,管路员可以不选
                {
                    if (btnLocation.Tag == null)
                    {
                        throw new Exception("请选择所属区域");
                    }
                }


                coreUser UserData = new coreUser();
                UserData.USER_ID = Tel;
                if (btnLocation.Tag != null)
                {
                    UserData.USER_LOCATIONID = btnLocation.Tag.ToString();
                }
                UserData.USER_NAME     = txtName.Text;
                UserData.USER_PASSWORD = pwd1;
                UserData.USER_PHONE    = Tel;
                UserData.USER_LANGUAGE = 0;
                UserData.USER_ROLE     = radioGroup1.CheckedButton.Value;

                ReturnInfo RInfo = autofacConfig.coreUserService.AddUser(UserData);
                if (RInfo.IsSuccess)
                {
                    Client.Session["UserID"] = Tel;
                    Client.Session["Role"]   = radioGroup1.CheckedButton.Value;
                    //关闭当前界面
                    this.Close();
                    frmAssets frm = new frmAssets();
                    //跳转到资产主界面
                    Show(frm);
                }
                else
                {
                    throw new Exception(RInfo.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
示例#8
0
        private void iconMenu_ItemPress(object sender, IconMenuViewItemPressEventArgs e)
        {
            switch (e.Item.Value)
            {
            //资产
            case "Assets":
                frmAssets frmAssets = new frmAssets();
                if (btnWareHouse.Tag != null)
                {
                    frmAssets.wareId = btnWareHouse.Tag.ToString();
                }
                this.Form.Show(frmAssets);
                break;

            case "AssTemplate":
                frmAssTemplate frmAssTemplate = new frmAssTemplate();
                this.Form.Show(frmAssTemplate);
                break;

            case "AssIn":
                frmAssIn frmAssIn = new frmAssIn();
                this.Form.Show(frmAssIn);
                break;

            case "AssOut":
                frmAssOut frmAssOut = new frmAssOut();
                this.Form.Show(frmAssOut);
                break;

            case "AssTransfer":
                frmAssTransferRows frmAssTransferRows = new frmAssTransferRows();
                this.Form.Show(frmAssTransferRows);
                break;

            case "AssInventory":
                frmAssInventory frmAssInventory = new frmAssInventory();
                this.Form.Show(frmAssInventory);
                break;

            //耗材
            case "ConManage":
                frmConsumables frmConsumables = new frmConsumables();
                this.Form.Show(frmConsumables);
                break;

            case "ConIn":
                frmConPORInSto frmConPORInSto = new frmConPORInSto();
                this.Form.Show(frmConPORInSto);
                break;

            case "ConOut":
                frmConSOROutbound frmConSOROutbound = new frmConSOROutbound();
                this.Form.Show(frmConSOROutbound);
                break;

            case "ConTransfer":
                frmTransferRows frmTransferRows = new frmTransferRows();
                this.Form.Show(frmTransferRows);
                break;

            case "ConInventory":
                frmConInventory frmConInventory = new frmConInventory();
                this.Form.Show(frmConInventory);
                break;
            }
        }