/// <summary>
        /// 初始化库房下拉框
        /// </summary>
        private void InitData_StoneInfo()
        {
            DataTable dtStone = CommUtilBLL.GetInstance().GetBuyerStoreInfo(CurrentUser.UserOrg.Id);

            if (dtStone != null)
            {
                this.StoreRoomLue.DataSource = dtStone.DefaultView;

                storeId = Convert.ToInt32(dtStone.Rows[0]["STORE_ID"].ToString().Trim());
            }
        }
        /// <summary>
        /// 绑定品种分类信息
        /// </summary>
        private void InitData_ProjectClass()
        {
            //绑定品种分类信息
            dtProductClass = CommUtilBLL.GetInstance().GetProductClassInfoByProjectID("");

            this.LueProductClass.Properties.DataSource = dtProductClass.DefaultView;
            LueProductClass.Properties.Columns.Clear();
            LueProductClass.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("CLASS_NAME", 100, "分类名称"));
            LueProductClass.Properties.DisplayMember = "CLASS_NAME";
            LueProductClass.Properties.ValueMember   = "ID";
            LueProductClass.Properties.NullText      = "全部";

            LueProductClass.EditValue = 0;//默认为“全部”
        }
        /// <summary>
        /// 绑定项目名称
        /// </summary>
        private void InitData_Project()
        {
            //绑定项目名称
            DataTable dtPro = CommUtilBLL.GetInstance().GetProjectInfoByProjectType("");

            LueProject.Properties.DataSource = dtPro;
            LueProject.Properties.Columns.Clear();
            LueProject.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("PROJECT_NAME", 200, "项目名称"));
            LueProject.Properties.DisplayMember = "PROJECT_NAME";
            LueProject.Properties.ValueMember   = "ID";
            LueProject.Properties.NullText      = "请选择项目";

            string DefaultProjectID = dtPro.Rows[0]["ID"].ToString().Trim();

            LueProject.EditValue = Convert.ToInt32(DefaultProjectID);
        }
示例#4
0
        /// <summary>
        /// 初始化型号下拉框
        /// </summary>
        private void InitData_ModelInfo()
        {
            DataTable dtModel = CommUtilBLL.GetInstance().GetModelInfo();

            this.ModelLue.DataSource = dtModel.DefaultView;
        }
示例#5
0
        /// <summary>
        /// 初始化规格下拉框
        /// </summary>
        private void InitData_SpecInfo()
        {
            DataTable dtSpec = CommUtilBLL.GetInstance().GetSpecInfo();

            this.SpecLue.DataSource = dtSpec.DefaultView;
        }
示例#6
0
        /// <summary>
        /// 初始化库房下拉框
        /// </summary>
        private void InitData_StoneInfo()
        {
            DataTable dtStone = CommUtilBLL.GetInstance().GetBuyerStoreInfo(base.CurrentUserOrgId);

            this.StoreRoomLue.DataSource = dtStone.DefaultView;
        }
        /// <summary>
        ///  发送用户名和密码,处理可能出现的异常,登录成功后将User对象放入客户端,然后启动主窗体。
        /// </summary>
        private void login()
        {
            if (!CheckName())
            {
                this.userNameTextBox.Focus();
                this.userNameTextBox.SelectAll();
                return;
            }

            if (!CheckPassword())
            {
                this.passwordTextBox.Focus();
                this.passwordTextBox.SelectAll();
                return;
            }

            try
            {
                LogedInUser user = null;
                //if (ClientConfiguration.IsOffline && (File.Exists(ClientConfiguration.LocalDBFile) && LoginUserOfflineBLL.GetInstance("ClientDB").GetUserCount(userNameTextBox.Text.Trim()) > 0))
                //{
                //    //离线登录,并取得当前登录用户信息
                //    user = LoginUserOfflineBLL.GetInstance("ClientDB").Login(userNameTextBox.Text.Trim(), passwordTextBox.Text);

                //}
                //else
                //{
                //    //在线
                //    user = ProxyFactory.UserProxy.DoLogin(userNameTextBox.Text.Trim(), passwordTextBox.Text);

                //}
                user                 = new LogedInUser();
                user.UserInfo        = new UserInfo();
                user.UserInfo.Name   = "test";
                user.UserInfo.Org_id = "123456";
                user.UserInfo.Id     = "123321";
                user.HighId          = CommUtilBLL.GetInstance().GetHighID();
                ClientSession.GetInstance().CurrentUser = user;
            }
            catch (LoginException loginEx)
            {
                XtraMessageBox.Show(string.Format("用户登录失败:\n  {0}.", loginEx.Message), "登录失败", MessageBoxButtons.OKCancel);
                //XtraMessageBox.Show(loginEx.StackTrace);
                EventLog.WriteEntry("login", loginEx.StackTrace);
                return;
            }
            catch (Exception ex)
            {
                //这个处理不友好,发布前需要修改
                XtraMessageBox.Show(string.Format("用户登录失败:\n  {0}.", ex.Message), "登录失败", MessageBoxButtons.OKCancel);
                //XtraMessageBox.Show(ex.StackTrace);
                EventLog.WriteEntry("login", ex.StackTrace);
                return;
            }

            //usercode写入到app.config文件
            string userCode     = userNameTextBox.Text;
            string userCodeList = ClientConfiguration.UserCode;

            if (!userCodeList.Contains(userCode))
            {
                if (!string.IsNullOrEmpty(userCodeList))
                {
                    ClientConfiguration.UserCode = userCode + "," + userCodeList;
                }
                else
                {
                    ClientConfiguration.UserCode = userCode;
                }
            }
            ClientConfiguration.LastUserCode = userCode;
            ClientConfiguration.Save();

            this.passwordTextBox.Text = "";
            this.Hide();
            new MainForm().Show();

            //this.Close();
        }
        /// <summary>
        ///  发送用户名和密码,处理可能出现的异常,登录成功后将User对象放入客户端,然后启动主窗体。
        /// </summary>
        private void login()
        {
            if (!CheckName())
            {
                this.userNameTextBox.Focus();
                this.userNameTextBox.SelectAll();
                return;
            }

            if (!CheckPassword())
            {
                this.passwordTextBox.Focus();
                this.passwordTextBox.SelectAll();
                return;
            }

            try
            {
                LogedInUser user = null;
                if (ClientConfiguration.IsOffline && (File.Exists(ClientConfiguration.LocalDBFile) && LoginUserOfflineBLL.GetInstance("ClientDB").GetUserCount(userNameTextBox.Text.Trim()) > 0))
                {
                    //离线登录,并取得当前登录用户信息
                    user = LoginUserOfflineBLL.GetInstance("ClientDB").Login(userNameTextBox.Text.Trim(), SecretUtil.MD5Encoding(passwordTextBox.Text));
                }
                else
                {
                    //在线
                    user = ProxyFactory.UserProxy.DoLogin(userNameTextBox.Text.Trim(), SecretUtil.MD5Encoding(passwordTextBox.Text));
                }

                user.HighId = CommUtilBLL.GetInstance("ClientTempDB").GetHighID();
                ClientSession.GetInstance().CurrentUser = user;
                ClientSession.GetInstance().IsLogin     = true;
            }
            catch (LoginException loginEx)
            {
                XtraMessageBox.Show(string.Format("用户登录失败:\n  {0}.", loginEx.Message), "登录失败", MessageBoxButtons.OKCancel);
                //XtraMessageBox.Show(loginEx.StackTrace);
                EventLog.WriteEntry("login", loginEx.StackTrace);
                return;
            }
            catch (Exception ex)
            {
                //这个处理不友好,发布前需要修改
                XtraMessageBox.Show(string.Format("用户登录失败:\n  {0}.", ex.Message), "登录失败", MessageBoxButtons.OKCancel);
                //XtraMessageBox.Show(ex.StackTrace);
                EventLog.WriteEntry("login", ex.StackTrace);
                return;
            }
            this.Hide();
            //usercode写入到app.config文件
            string userCode     = userNameTextBox.Text;
            string userCodeList = ClientConfiguration.UserCode;

            if (!userCodeList.Contains(userCode))
            {
                if (!string.IsNullOrEmpty(userCodeList))
                {
                    ClientConfiguration.UserCode = userCode + "," + userCodeList;
                }
                else
                {
                    ClientConfiguration.UserCode = userCode;
                }
            }
            ClientConfiguration.LastUserCode = userCode;
            ClientConfiguration.Save();

            UserConfigXml.SetConfigInfo("LoginLog", "LoginedUsersCode", ClientConfiguration.UserCode);
            UserConfigXml.SetConfigInfo("LoginLog", "LastLoginedUserCode", ClientConfiguration.LastUserCode);


            this.passwordTextBox.Text = "";
            if (!ClientConfiguration.MenuStyle.Equals("0"))
            {
                new MainForm(this).Show();
            }
            else
            {
                new ParentForm(this).Show();
            }
            //this.Close();
        }
        /// <summary>
        /// 根据买方ID,项目ID,项目产品ID绑定配送商
        /// </summary>
        /// <param name="buyerId"></param>
        /// <param name="projectId"></param>
        /// <param name="projectProdId"></param>
        private void InitData_BuyerSender(string buyerId, string projectId, string projectProdId)
        {
            DataTable SenderDt = CommUtilBLL.GetInstance().GetSenderInfo(buyerId, projectId, projectProdId);

            this.LueSenderName.Properties.DataSource = SenderDt;
        }
        /// <summary>
        /// 初始化库房下拉框
        /// </summary>
        private void InitData_StoneInfo()
        {
            DataTable dtStone = CommUtilBLL.GetInstance().GetBuyerStoreInfo(base.CurrentUserOrgId);

            this.LueStoreName.Properties.DataSource = dtStone;
        }