Esempio n. 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var sqlstr = "UpdatePwd";
            var con    = new SqlConnection(MaLogin.WmsCon);
            var cmd    = new SqlCommand(sqlstr, con)
            {
                CommandType = CommandType.StoredProcedure
            };

            cmd.Parameters.AddWithValue("@uName", utxtUser.Text);
            cmd.Parameters.AddWithValue("@uPassword", WmsFunction.GetMd5Hash(utxtPassword.Text));
            cmd.Parameters.AddWithValue("@uPwd", WmsFunction.GetMd5Hash(utxtPwd.Text));
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"发生异常" + ex.Message, @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show(@"修改失败", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(@"修改成功", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 2
0
        private void uGridUser_ClickCellButton(object sender, CellEventArgs e)
        {
            var sqlstr = "update BUser set uPassword=@uPwd where uCode=@uName";
            var con    = new SqlConnection(MaLogin.WmsCon);
            var cmd    = new SqlCommand(sqlstr, con);

            cmd.Parameters.AddWithValue("@uName", e.Cell.Value);
            cmd.Parameters.AddWithValue("@uPwd", WmsFunction.GetMd5Hash("123456"));
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"发生异常" + ex.Message, @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show(@"重置失败", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(@"重置成功", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 3
0
 public static string GetUri()
 {
     var cmd = new SqlCommand("select top 1 cValue from BSetting where cName=@cName");
     cmd.Parameters.AddWithValue("@cName", "WYI");
     var wf = new WmsFunction(BaseStructure.WmsCon);
     UriString=wf.ReturnFirstSingle(cmd);
     return UriString;
 }
Esempio n. 4
0
 public static string GetBoxWeight(string cBoxNumber)
 {
     using (var cmd = new SqlCommand(@"select isnull(iWeight,0) from SS_Box where cBoxNumber=@cBoxNumber"))
     {
         cmd.Parameters.AddWithValue("@cBoxNumber", cBoxNumber);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ReturnFirstSingle(cmd));
     }
 }
Esempio n. 5
0
 public static string GetPrintLog(string cGuid)
 {
     using (var cmd = new SqlCommand(@"select dAddTime from BLogPrint WHERE cGuid=@cGuid"))
     {
         cmd.Parameters.AddWithValue("@cGuid", cGuid);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ReturnFirstSingle(cmd));
     }
 }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cKey"></param>
 /// <returns></returns>
 public static string GetMenuClass(string cKey)
 {
     using (var cmd = new SqlCommand(@"select cClass from BFunction WHERE cFunction=@cFunction"))
     {
         cmd.Parameters.AddWithValue("@cFunction", cKey);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ReturnFirstSingle(cmd));
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="cKey"></param>
 /// <returns></returns>
 public static string GetMenuClass(string cKey)
 {
     using (var cmd = new SqlCommand(@"select cClass from BFunction WHERE cFunction=@cFunction"))
     {
         cmd.Parameters.AddWithValue("@cFunction", cKey);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return wf.ReturnFirstSingle(cmd);
     }
 }
Esempio n. 8
0
 public static string GetBarCodeBySerialNumber(string cSerialNumber)
 {
     using (var logCmd = new SqlCommand(@"GetBarCodeBySerialNumber"))
     {
         logCmd.CommandType = CommandType.StoredProcedure;
         logCmd.Parameters.AddWithValue("@cSerialNumber", cSerialNumber);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ReturnFirstSingle(logCmd));
     }
 }
Esempio n. 9
0
 public static bool RecordPrintLog(string cGuid)
 {
     using (var cmd = new SqlCommand(@"INSERT INTO  BLogPrint (cGuid,cOperator) Values(@cGuid,@cOperator)"))
     {
         cmd.Parameters.AddWithValue("@cGuid", cGuid);
         cmd.Parameters.AddWithValue("@cOperator", BaseStructure.LoginName);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ExecSqlCmd(cmd));
     }
 }
Esempio n. 10
0
        public static string GetUri()
        {
            var cmd = new SqlCommand("select top 1 cValue from BSetting where cName=@cName");

            cmd.Parameters.AddWithValue("@cName", "WYI");
            var wf = new WmsFunction(BaseStructure.WmsCon);

            UriString = wf.ReturnFirstSingle(cmd);
            return(UriString);
        }
Esempio n. 11
0
        /// <summary>
        /// 验证登录
        /// </summary>
        private void OkLogin()
        {
            try
            {
                var ws = new WmsService.BaseConService {
                    Url = "http://" + utxtServer.Text + "/BaseConService.asmx"
                };
                WmsCon        = ws.GetWmsConstring();
                WmsServiceUri = ws.Url;
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"服务器填写错误,或者服务器端未配置正确!
" + ex.Message, @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            lblLogin.Image = Properties.Resources.LoginForm_login_btn_click;

            if (string.IsNullOrEmpty(utxtUser.Text.Trim()) || string.IsNullOrEmpty(utxtPassword.Text))
            {
                MessageBox.Show(@"用户名和密码必填!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //记住账套信息
            if (utxtAccount.Value == null || WmsCon == null)
            {
                MessageBox.Show(@"服务器选择有误!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var strpwd = WmsFunction.GetMd5Hash(utxtPassword.Text);
            var cmd    = new SqlCommand("select * from BUser where uCode='admin' and uPassword=@uPassword");

            cmd.Parameters.AddWithValue("@uPassword", strpwd);
            var wf = new WmsFunction(WmsCon);

            if (!wf.BoolExistTable(cmd))
            {
                MessageBox.Show(@"admin密码不正确!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Hide();
            var mm = new MaMain();

            mm.ShowDialog();

            LoginDate = udDate.DateTime.Date;
            WmsServer = utxtServer.Text;
            Properties.Settings.Default.cServer = utxtServer.Text;
            Properties.Settings.Default.Save();
        }
Esempio n. 12
0
 public static bool RecordLogAction(string cFunction, string cDescription)
 {
     using (var logCmd = new SqlCommand(@"AddLogAction"))
     {
         logCmd.CommandType = CommandType.StoredProcedure;
         logCmd.Parameters.AddWithValue("@cFunction", cFunction);
         logCmd.Parameters.AddWithValue("@cDescription", cDescription);
         var wf = new WmsFunction(BaseStructure.WmsCon);
         return(wf.ExecSqlCmd(logCmd));
     }
 }
Esempio n. 13
0
 /// <summary>
 /// 获取当前界面的设置的默认打印机与默认打印模版
 /// </summary>
 /// <param name="cFunction">当前的界面</param>
 /// <param name="cCaption">打印模版标题</param>
 /// <param name="cPrinter">打印机</param>
 /// <param name="cTempletPath">打印模版的路径</param>
 public static void GetTemplet(string cFunction, ref string cCaption, ref string cPrinter, ref string cTempletPath)
 {
     var cmd = new SqlCommand("select * from [dbo].[BTempletList] where cFunction =@cFunction and bDefault=1");
     cmd.Parameters.AddWithValue("@cFunction", cFunction);
     var wf = new WmsFunction(BaseStructure.WmsCon);
     var dt = wf.GetSqlTable(cmd);
     if (dt != null && dt.Rows.Count > 0)
     {
         cCaption = dt.Rows[0]["cCaption"].ToString();
         cPrinter = dt.Rows[0]["cPrinter"].ToString();
         cTempletPath = dt.Rows[0]["cTempletPath"].ToString();
     }
 }
Esempio n. 14
0
        /// <summary>
        /// 获取当前界面的设置的默认打印机与默认打印模版
        /// </summary>
        /// <param name="cFunction">当前的界面</param>
        /// <param name="cCaption">打印模版标题</param>
        /// <param name="cPrinter">打印机</param>
        /// <param name="cTempletPath">打印模版的路径</param>
        public static void GetTemplet(string cFunction, ref string cPrinter)
        {
            var cmd = new SqlCommand("select * from [dbo].[BTempletList] where cFunction =@cFunction and bDefault=1");

            cmd.Parameters.AddWithValue("@cFunction", cFunction);
            var wf = new WmsFunction(MaLogin.WmsCon);
            var dt = wf.GetSqlTable(cmd);

            if (dt != null && dt.Rows.Count > 0)
            {
                cPrinter = dt.Rows[0]["cPrinter"].ToString();
            }
        }