private void BuyPaymentForm_Load(object sender, EventArgs e) { try { //绑定采购明细 DataTable dt = ch.DataTableReCoding(bpm.SelEmp(" buy.Buy_Code='" + XYEEncoding.strCodeHex(_buycode) + "'").Tables[0]); superGridControl1.PrimaryGrid.DataSource = dt; superGridControl1.PrimaryGrid.AllowEdit = false; LoginInfomation l = LoginInfomation.getInstance(); l.UserName = "******"; ltxt_operation.Text = l.UserName; txt_yifu.Visible = false; ltxt_weipay.ReadOnly = true; dataGridViewFujia.ReadOnly = true; dataGridViewFujia.AllowUserToResizeColumns = false; //是否可以调整列的大小 dataGridViewFujia.AllowUserToResizeRows = false; //是否可以调整行的大小 txt_caigoucode.Text = _buycode; ltxt_suname.Text = _suname; ltxt_AccountName.Text = _acountname; txt_shif.Text = _fukuan; ltxt_saleman.Text = _saleman; } catch (Exception ex) { MessageBox.Show("错误代码:3205-创建采购付款单异常,异常信息:" + ex.Message); } textBoxOddNumbers.Text = BuildCode.ModuleCode("AP"); }
public bool update(LoginInfomation loginInfo, string key, PubMemo item) { try { using (var conn = new WebMemoDBDataContext(getConnectionString(loginInfo))) { PubMemo src = (from s in conn.PubMemo where s.id == item.id select s).FirstOrDefault(); src.title = item.title; src.category1 = item.category1; src.category2 = item.category2; src.category3 = item.category3; src.memo = item.memo; conn.SubmitChanges(); return(true); } } catch (SqlException ex) { ex.ToString(); return(false); } }
private void BuyFollowInformation_Load(object sender, EventArgs e) { LoginInfomation l = LoginInfomation.getInstance(); l.UserName = "******"; txt_caozuoman.Text = l.UserName; txt_buycode.Text = _buycode; }
private void buttonXLogin_Click(object sender, EventArgs e) { User u = new User(); UserManager um = new UserManager(); PermissionManager pm = new PermissionManager(); string name = textBoxXName.Text.Trim(); string password = textBoxXPassword.Text.Trim(); if (string.IsNullOrWhiteSpace(name)) { labelName.Visible = true; labelNull.Text = "请输入用户名"; labelNull.Visible = true; } else if (string.IsNullOrWhiteSpace(password)) { labelPW.Visible = true; labelNull.Text = "请输入密码"; labelNull.Visible = true; } else { if (!um.Exists(name)) { labelName.Visible = false; labelPW.Visible = false; labelNull.Text = "用户名不存在"; labelNull.Visible = true; return; } DataTable user = um.GetUserAndRoleModel(name, password); if (user.Rows.Count > 0) { LoginInfomation information = LoginInfomation.getInstance(); information.UserName = user.Rows[0]["User_Name"].ToString(); information.UserRole = user.Rows[0]["Role_Name"].ToString(); information.UserCode = user.Rows[0]["User_Code"].ToString(); //根据角色里的权限编码查询所拥有的权限信息 DataSet permission = pm.GetList("Per_Code = '" + XYEEncoding.strCodeHex(user.Rows[0]["Role_Modules"].ToString()) + "'"); getPermissionList(permission); Close(); } else { labelNull.Text = "密码不正确"; labelNull.Visible = true; } } }
public FormMain(FormLogin formLogin, LoginInfomation loginInfo) { InitializeComponent(); this.Load += (s, e) => Form_Restore.LoadPosSize(this, FORM_NAME); this.FormClosed += (s, e) => Form_Restore.SavePosSize(this, FORM_NAME); //this.Load += FormMain_Load; //this.FormClosed += FormMain_FormClosed; this.formLogin = formLogin; this.loginInfo = loginInfo; menuLogout.Click += menuLogout_Click; menuExit.Click += menuExit_Click; }
public bool insert(LoginInfomation loginInfo, string key, PubMemo item) { try { using (var conn = new WebMemoDBDataContext(getConnectionString(loginInfo))) { conn.PubMemo.InsertOnSubmit(item); conn.SubmitChanges(); return(true); } } catch (SqlException ex) { ex.ToString(); return(false); } }
public List <PubMemo> getAll(LoginInfomation loginInfo, string key) { try { using (var conn = new WebMemoDBDataContext(getConnectionString(loginInfo))) { List <PubMemo> result = (from s in conn.PubMemo select s).ToList(); return(result); } } catch (SqlException ex) { ex.ToString(); return(null); } }
// DB 의 여러 필드에 대해 각각의 Keyword 로 OR 검색하는거 public List <PubMemo> search(LoginInfomation loginInfo, string key, Dictionary <DBIndex.PubMemo, string> keyword) { try { using (var conn = new WebMemoDBDataContext(getConnectionString(loginInfo))) { // where 절 or 문으로 여러개 붙이는거 var pred = PredicateBuilder.False <PubMemo>(); if (keyword.ContainsKey(DBIndex.PubMemo.title)) { pred = pred.Or(p => p.title.Contains(keyword[DBIndex.PubMemo.title])); } if (keyword.ContainsKey(DBIndex.PubMemo.category1)) { pred = pred.Or(p => p.category1.Contains(keyword[DBIndex.PubMemo.category1])); } if (keyword.ContainsKey(DBIndex.PubMemo.category2)) { pred = pred.Or(p => p.category2.Contains(keyword[DBIndex.PubMemo.category2])); } if (keyword.ContainsKey(DBIndex.PubMemo.category3)) { pred = pred.Or(p => p.category3.Contains(keyword[DBIndex.PubMemo.category3])); } if (keyword.ContainsKey(DBIndex.PubMemo.memo)) { pred = pred.Or(p => p.memo.Contains(keyword[DBIndex.PubMemo.memo])); } // 작성한 where 문을 이용해 sql 문을 작성 // IQueryable 형식이 sql 문이라고 봐도 무방할듯.. // 물론 sql 뿐만 아니고, 거기에 데이타베이스 연결작업에 필요한 모든 정보를 가지고 있는거 같음.. IQueryable <PubMemo> bb = from p in conn.PubMemo.Where(pred) select p; // 그리고 IQueryable 에서 ToList() 를 할때, 실제 DB 에 접근해 sql 문을 보내고 결과를 받아온다. List <PubMemo> result = bb.ToList(); return(result); } } catch (SqlException ex) { ex.ToString(); return(null); } }
private void btnLogin_Click(object sender, EventArgs e) { LoginInfomation lastInfo = new LoginInfomation() { serverName = tbServerName.Text, userName = tbUserName.Text, password = tbPassword.Text }; lastInfo.save(); this.Hide(); FormMain formmain = new FormMain(this, lastInfo); formmain.Show(); //TestForm tf = new TestForm(); //tf.Show(); }
private void updateUIFromData() { LoginInfomation lastInfo = new LoginInfomation(); lastInfo.load(); tbServerName.Text = lastInfo.serverName; tbUserName.Text = lastInfo.userName; if (tbServerName.Text.Length > 0) { tbUserName.Select(); } if (tbUserName.Text.Length > 0) { tbPassword.Text = ""; tbPassword.Select(); } }
/// <summary> /// 获取所有的权限列表并存储 /// </summary> /// <param name="ds"></param> private void getPermissionList(DataSet ds) { LoginInfomation information = LoginInfomation.getInstance(); foreach (DataRow dr in ds.Tables[0].Rows) { if ((int)dr["Per_ReadState"] == 1) { information.ReadPermission.Add(dr["Per_ModuleName"].ToString()); } if ((int)dr["Per_WriteState"] == 1) { information.WritePermission.Add(dr["Per_ModuleName"].ToString()); } if ((int)dr["Per_AuditState"] == 1) { information.AuditPermission.Add(dr["Per_ModuleName"].ToString()); } } }
public bool delete(LoginInfomation loginInfo, PubMemo item) { try { using (var conn = new WebMemoDBDataContext(getConnectionString(loginInfo))) { PubMemo src = (from s in conn.PubMemo where s.id == item.id select s).FirstOrDefault(); conn.PubMemo.DeleteOnSubmit(src); conn.SubmitChanges(); return(true); } } catch (SqlException ex) { ex.ToString(); return(false); } }
private string getConnectionString(LoginInfomation loginInfo) { return(string.Format(Properties.Settings.Default.WebMemoConnectionString, loginInfo.serverName, loginInfo.userName, loginInfo.password)); }
private void InsSellGathering_Load(object sender, EventArgs e) { #region 初始化列 GridColumn gc = null; gc = new GridColumn(); gc.DataPropertyName = "Sell_Code"; gc.Name = "Code"; gc.HeaderText = "销售单号"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_StockName"; gc.Name = "StockName"; gc.HeaderText = "仓库名称"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_MaID"; gc.Name = "MaID"; gc.HeaderText = "编码"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_MaName"; gc.Name = "MaName"; gc.HeaderText = "商品名称"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Model"; gc.Name = "Model"; gc.HeaderText = "规格型号"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Unit"; gc.Name = "Unit"; gc.HeaderText = "单位"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_DiscountBPrice"; gc.Name = "DiscountBPrice"; gc.HeaderText = "单价"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_CurNumber"; gc.Name = "CurNumber"; gc.HeaderText = "需求数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_ReNumber"; gc.Name = "ReNumber"; gc.HeaderText = "实发数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_LostNumber"; gc.Name = "LostNumber"; gc.HeaderText = "缺少数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Discount"; gc.Name = "Discount"; gc.HeaderText = "折扣率"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_DiscountBPrice"; gc.Name = "DiscountBPrice"; gc.HeaderText = "折后金额"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Money"; gc.Name = "Money"; gc.HeaderText = "总金额"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Remark"; gc.Name = "Remark"; gc.HeaderText = "备注"; superGridControl1.PrimaryGrid.Columns.Add(gc); superGridControl1.PrimaryGrid.DataSource = sdm.GetList(string.Format("Sell_Code='{0}'", XYEEncoding.strCodeHex(Sell_Code))); #endregion //ltxt_salecode.Text = Sell_Code; ; //ltxt_kehu.Text = C_ClientName; //ltxt_AccountName.Text = C_AccountName; //ltxt_yingshou.Text = C_AmountPay; ltxt_shishou.Text = "0"; ltxt_weishou.Text = "0"; ltxt_shoukuan.Text = "0"; ltxt_yingshou.Text = "0"; // ltxt_salecode.Text = _sellcode; Model.Sell sell = sm.SelSellGatheringBySellCode(ltxt_salecode.Text.Trim()); ltxt_salecode.Text = _sellcode; ltxt_kehu.Text = _Sell_ClientName; ltxt_yingshou.Text = Convert.ToDecimal(_OddMoney).ToString("0.00"); ltxt_shoukuan.Text = Convert.ToDecimal(_InMoney).ToString("0.00"); ltxt_weishou.Text = Convert.ToDecimal(_LastMoney).ToString("0.00"); ltxt_method.Text = _fukuanfangshi; ltxt_saleman.Text = _Salesman; ltxt_remark.Text = _Remark; //if (sell != null) //{ // ltxt_salecode.Text = _sellcode; // ltxt_kehu.Text = sell.Sell_ClientName; // ltxt_AccountName.Text = sell.Sell_AccountCode; // ltxt_yingshou.ReadOnly = true; // ltxt_yingshou.Text = Convert.ToDecimal(sell.Sell_OddMoney).ToString("0.00"); // ltxt_shoukuan.Text = Convert.ToDecimal(sell.Sell_InMoney).ToString("0.00"); // ltxt_weishou.Text = Convert.ToDecimal(sell.Sell_LastMoney).ToString("0.00"); // ltxt_method.Text = sell.Sell_fukuanfangshi; // ltxt_saleman.Text = sell.Sell_Salesman; // ltxt_operation.Text = sell.Sell_Operation; // ltxt_remark.Text = sell.Sell_Remark; // ltxt_weishou.Text = sell.Sell_OddMoney; //} if (string.IsNullOrWhiteSpace(textBoxOddNumbers.Text)) { textBoxOddNumbers.Text = BuildCode.ModuleCode("AC"); conll.C_No = textBoxOddNumbers.Text;//资金收款编号 } //ltxt_salecode.Text //textBoxX1.Text = "0"; //制单人 LoginInfomation l = LoginInfomation.getInstance(); l.UserName = "******"; ltxt_operation.Text = l.UserName; dataGridViewFujia.ReadOnly = true; dataGridViewFujia.AllowUserToResizeColumns = false; //是否可以调整列的大小 dataGridViewFujia.AllowUserToResizeRows = false; //是否可以调整行的大小 }