protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Enter)) { lblTransactionName.Text = gen.GetString2("Transactions", "TransactionName", "TransactionCode", txtTransactionCode.Text); return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void Frm_RolePermissionMapping_Load(object sender, EventArgs e) { txtRoleCode.Text = gen.GetString2("Roles", "rolecode", "roleid", roleid, clientid); //SQLString = "select [rolecode] from [Roles] where roleid='" + a + "' AND ClientID=" + cliendid; lblRoleName.Text = gen.GetString2("Roles", "rolename", "roleid", roleid, clientid); //load lai datagrid RolePermissionMapping Datagrid_update(roleid); // Load txtTransactionCode table. load_txtTransactionCode(roleid); //load combobox permission load_permission(); }
//enter ra ten username protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Enter)) { //MessageBox.Show("ButtonEdit Validated!"); lblUsername.Text = gen.GetString2("MSC_User", "FullName", "UserName", txtUser.Text); return(true); } if (keyData == (Keys.Escape)) { this.Close(); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void btlogin_Click(object sender, EventArgs e) { if (txtten.Text == "Tên đăng nhập" || txtten.Text == "") { XtraMessageBox.Show("Bạn chưa nhập tên đăng nhập.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtten.Focus(); } else if (txtmk.Text == "Mật khẩu" || txtmk.Text == "") { XtraMessageBox.Show("Bạn chưa nhập mật khẩu.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmk.Focus(); } else { try { // gencon gen = new gencon(); //trong luc cho xu lý thì load frm_wait lên SplashScreenManager.ShowForm(typeof(Frm_wait)); string userid = ""; try { userid = gen.GetString("select Userid from Users where UserName='******' and Password='******' AND " + " ClientID =" + txtClient.Text); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Error); } SplashScreenManager.CloseForm(); //int clientid = Int16.Parse(txtClientID.Text); Globals.userid = userid; Globals.clientid = Int32.Parse(txtClient.Text); Globals.username = txtten.Text.Replace("-", ""); Globals.companycode = gen.GetString2("Users", "companycode", "Username", Globals.username, Globals.clientid); Globals.ngaychungtu = DateTime.Now.ToString(); //DataTable dtinfo = gen.GetTable("select FullName,BranchName,a.BranchID from MSC_User a with (NOLOCK), Branch b with (NOLOCK) where UserID='" + userid + "' and a.BranchID=b.BranchID "); //Globals.branchid = dtinfo.Rows[0][2].ToString(); //Globals.khach = gen.GetTable("select AccountingObjectID as 'ID',AccountingObjectCode as 'Mã khách hàng',AccountingObjectName as 'Tên khách',Address as 'Địa chỉ', CompanyTaxCode as 'Mã số thuế', ContactHomeTel as 'Đội' from AccountingObject with (NOLOCK) order by AccountingObjectCode"); //Globals.hang = gen.GetTable("select InventoryItemID as 'ID',InventoryItemCode as 'Mã hàng hóa',InventoryItemName as 'Tên hàng',Unit as 'Đơn vị tính', ConvertUnit as 'Đơn vị quy đổi',convert(decimal(22,2),ConvertRate) as 'Tỷ lệ quy đổi',SalePrice as 'Đơn giá tham khảo',GuarantyPeriod as 'Công ty' from InventoryItem with (NOLOCK) order by InventoryItemCode"); //Globals.roleid = gen.GetString("select RoleID from MSC_UserJoinRole with (NOLOCK) where UserID='" + userid + "'"); //Form1 F = new Form1();// mo Form 1 báo cáo ghi nợ MainForm F = new MainForm(); //F.getform(this); //-- cua Form1 //F.getuserid(userid); //-- cua Form1 F.Show(); } catch { XtraMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmk.Text = ""; txtmk.Focus(); SplashScreenManager.CloseForm(); } } }
private void get_report_BCTK() // bao cao ton kho { DataTable dt = new DataTable(); dt.Columns.Add("InventoryItemCode", Type.GetType("System.String")); //0 dt.Columns.Add("TenHH", Type.GetType("System.String")); //1 dt.Columns.Add("StockCode", Type.GetType("System.String")); //2 dt.Columns.Add("QuantityDK", Type.GetType("System.Double")); dt.Columns.Add("AmountDK", Type.GetType("System.Double")); dt.Columns.Add("QuantityNTK", Type.GetType("System.Double")); dt.Columns.Add("AmountNTK", Type.GetType("System.Double")); dt.Columns.Add("QuantityXTK", Type.GetType("System.Double")); dt.Columns.Add("AmountXTK", Type.GetType("System.Double")); dt.Columns.Add("QuantityCK", Type.GetType("System.Double")); dt.Columns.Add("AmountCK", Type.GetType("System.Double")); //temp = gen.GetTable("SELECT * from UserSalary where clientid = " + clientid + " AND CompanyCode = '" + Globals.companycode + "'"); //temp = dt; // get data for (int i = 0; i < temp.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = temp.Rows[i].Field <string>("InventoryItemCode"); dr[1] = ""; dr[2] = temp.Rows[i].Field <string>("StockCode"); dr[3] = temp.Rows[i].Field <int>("QuantityDK").ToString(); dr[4] = temp.Rows[i].Field <int>("AmountDK").ToString(); dr[5] = temp.Rows[i].Field <int>("QuantityNTK").ToString(); dr[6] = temp.Rows[i].Field <int>("QuantityNTK").ToString(); dr[7] = temp.Rows[i].Field <int>("AmountNTK").ToString(); dr[8] = temp.Rows[i].Field <int>("AmountXTK").ToString(); dr[9] = temp.Rows[i].Field <int>("QuantityCK").ToString(); dr[10] = temp.Rows[i].Field <int>("AmountCK").ToString(); dt.Rows.Add(dr); } rpbaocaotonkho rpbaocaotonkho = new rpbaocaotonkho(); string thang = String.Format("{0:MM}", DateTime.Parse(Globals.ngaychungtu)); string nam = DateTime.Parse(Globals.ngaychungtu).Year.ToString(); string stockcode = temp2.Rows[0][0].ToString(); string khoid = gen.GetString2("Stock", "StockID", "StockCode", stockcode, clientid); rpbaocaotonkho.gettieude("BÁO CÁO TỒN KHO HÀNG HÓA THÁNG " + thang + " NĂM " + nam, khoid, Globals.userid, Globals.ngaychungtu, "tsbtbctktsl", ""); rpbaocaotonkho.BindData(dt); printControl1.PrintingSystem = rpbaocaotonkho.PrintingSystem; rpbaocaotonkho.CreateDocument(); }
private void login_user() { if (txtten.Text == "Tên đăng nhập" || txtten.Text == "") { XtraMessageBox.Show("Bạn chưa nhập tên đăng nhập.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtten.Focus(); } else if (txtmk.Text == "Mật khẩu" || txtmk.Text == "") { XtraMessageBox.Show("Bạn chưa nhập mật khẩu.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmk.Focus(); }// else { try { //trong luc cho xu lý thì load frm_wait lên //SplashScreenManager.ShowForm(typeof(Frm_wait)); gencon gen = new gencon(); //XtraMessageBox.Show(Globals.constring, "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Error); string userid = ""; try { userid = gen.GetString("select Userid from MSC_User where UserName='******' and Password='******'"); if (userid != "") { this.Text = gen.GetString("select Top 1 CompanyName from Center"); Globals.userid = userid; //Globals.clientid = Int32.Parse(txtClient.Text); Globals.companycode = gen.GetString2("MSC_User", "CompanyCode", "Userid", userid); Globals.version = gen.GetString("select Version from Center where CompanyCode='" + Globals.companycode + "'"); Globals.username = txtten.Text.Replace("-", "").ToUpper(); Globals.companyname = this.Text; Globals.ngaychungtu = DateTime.Now.ToString(); //MainForm F = new MainForm(); Frm_Main F = new Frm_Main(); F.Show(); } else { XtraMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng hay tk bị block", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { //XtraMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmk.Text = ""; txtmk.Focus(); XtraMessageBox.Show(ex.Message, "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Error); //SplashScreenManager.CloseForm(); } } catch { XtraMessageBox.Show("Kết nối DB không thành công", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void Frm_stock_Load(object sender, EventArgs e) { DataTable daa = new DataTable(); DataTable temp1 = new DataTable(); temp1.Columns.Add("Mã tỉnh"); temp1.Columns.Add("Tên tỉnh"); var ctx = gen.GetNewEntity(); // khai bao new entity Framework; //var query = from ctx.Province ; var query = ctx.Provinces .OrderBy(c => c.ProvinceName); //.OrderBy(c => c.BranchCode); //daa = gen.GetTable("select * from Province order by ProvinceName"); foreach (var data2 in query) { DataRow dr = temp1.NewRow(); dr[0] = data2.ProvinceCode; dr[1] = data2.ProvinceName; temp1.Rows.Add(dr); } leprovince.Properties.DataSource = temp1; leprovince.Properties.ValueMember = "Mã tỉnh"; leprovince.Properties.DisplayMember = "Tên tỉnh"; leprovince.EditValue = "CT"; DataTable data = new DataTable(); DataTable da2 = new DataTable(); da2.Columns.Add("Mã kho"); da2.Columns.Add("Tên kho"); //data = gen.GetTable("select StockCode,StockName from Stock order by StockCode"); var query1 = ctx.Stocks .OrderBy(c => c.StockCode) .Select(c => new { c.StockCode, c.StockName }); foreach (var data2 in query1) { DataRow dr = da2.NewRow(); dr[0] = data2.StockCode; dr[1] = data2.StockName; da2.Rows.Add(dr); } lekho.Properties.DataSource = da2; lekho.Properties.DisplayMember = "Mã kho"; lekho.Properties.ValueMember = "Mã kho"; DataTable da1 = new DataTable(); da1.Columns.Add("ID", typeof(String)); da1.Columns.Add("Name", typeof(String)); //data = gen.GetTable("select branchCode, branchName,branchID from Branch order by branchCode"); var query2 = ctx.Branches .OrderBy(c => c.BranchCode); //.Select(c => new { c.BranchCode, c.BranchName, c.BranchID }); /*for (int i = 0; i < data.Rows.Count; i++) * { * da1.Rows.Add(new String[] { data.Rows[i][0].ToString(), data.Rows[i][1].ToString() }); * }*/ foreach (var data2 in query2) { DataRow dr = da1.NewRow(); dr[0] = data2.BranchCode; dr[1] = data2.BranchName; da1.Rows.Add(dr); } cbbranch.Properties.DataSource = da1; cbbranch.Properties.DisplayMember = "ID"; cbbranch.Properties.ValueMember = "ID"; if (active == "1") { this.Text = "Sửa kho"; txtcode.ReadOnly = true; DataTable da = new DataTable(); //da = gen.GetTable("select * from Stock where StockID='" + role + "'");\ var db = gen.GetNewEntity(); // khai bao new entity Framework { Guid stockid = Guid.Parse(role); var query3 = ctx.Stocks .Where(c => c.StockID == stockid && c.CompanyCode == Globals.companycode) .OrderBy(c => c.StockCode); //da = gen.ConvertToDataTable(query3); foreach (var data2 in query3) { txtcode.Text = data2.StockCode; txtname.Text = data2.StockName; txtdg.Text = data2.Description; // string stockid = data2.StockID.ToString(); lekho.EditValue = gen.GetString2("Stock", "StockCode", "StockID", data2.StockID.ToString(), Globals.clientid); cbbranch.EditValue = gen.GetString2("Branch", "BranchCode", "BranchID", data2.BranchID.ToString(), Globals.clientid); chbntd.Checked = data2.Inactive; LPG.Checked = (bool)data2.LPG; leprovince.EditValue = data2.Province; txtmst.Text = data2.Code; txttcn.Text = data2.InvName; txtnote.Text = data2.Note; } } /* * try * { * lekho.EditValue = gen.GetString("select StockCode from Stock where StockID='" + da.Rows[0][8].ToString() + "'"); * } * catch * { * lekho.EditValue = da.Rows[0][1].ToString(); * }*/ /*for (int i = 0; i < data.Rows.Count; i++) * { * if (da.Rows[0][4].ToString() == data.Rows[i][2].ToString()) * cbbranch.SelectedIndex = i; * }*/ } else { this.Text = "Thêm kho"; lekho.ItemIndex = 0; chbntd.Hide(); } }
private void txtFIDocNo_EditValueChanged(object sender, EventArgs e) { lbHeaderText.Text = gen.GetString2("FIDocument", "FIHeader", "FIDoc", txtFIDocNo.Text); }
private void load_topmenu() { // tao menu dua vao profile barManager1.BeginUpdate(); Bar bar1 = new Bar(barManager1, "My MainMenu"); bar1.DockStyle = BarDockStyle.Top; //bar1.DockRow = 0; barManager1.MainMenu = bar1; BarSubItem subMenuSystem = new BarSubItem(barManager1, "System"); BarButtonItem buttonOld = new BarButtonItem(barManager1, "Old version"); BarButtonItem buttonOpen = new BarButtonItem(barManager1, "Change Password"); BarButtonItem buttonExit = new BarButtonItem(barManager1, "Exit"); subMenuSystem.AddItems(new BarItem[] { buttonOld, buttonOpen, buttonExit }); //tao menu con trong profile UserJoinRole SQLString = "select * from UserJoinRole where username='******'"; dt = gen.GetTable(SQLString); for (int i = 0; i < dt.Rows.Count; i++) { string rcode = dt.Rows[i]["RoleCode"].ToString(); // rolecode string rolename = gen.GetString2("Roles", "RoleName", "RoleCode", rcode); BarSubItem subMenuFunctionsi = new BarSubItem(barManager1, rolename); bar1.AddItems(new BarItem[] { subMenuFunctionsi }); // ung voi moi profile tao menu con transaction try { var ctx = gen.GetNewEntity(); // khai bao new entity Framework var query = ctx.Transactions .Where(c => c.RoleCode == rcode && c.IsDisplay == 1 && c.IsParent == 0).OrderBy(c => c.SortNo); // khong co folder cha foreach (var data in query) { string tcode = data.TransactionCode.Trim(); string TransactionName = data.TransactionName; BarButtonItem buttonj = new BarButtonItem(barManager1, tcode + " - " + TransactionName); subMenuFunctionsi.AddItems(new BarItem[] { buttonj }); } } catch { // MessageBox.Show(SQLString); } // hien tiep cac folder DataTable dt2 = new DataTable(); SQLString = "select ParentFolder from Transactions where IsDisplay = 1 and IsParent = 1 and rolecode='" + rcode + "' group by ParentFolder"; dt2 = gen.GetTable(SQLString); for (int j = 0; j < dt2.Rows.Count; j++) { string ParentFolder = dt2.Rows[j]["ParentFolder"].ToString(); BarSubItem subMenuFunctionsj = new BarSubItem(barManager1, ParentFolder); subMenuFunctionsi.AddItems(new BarItem[] { subMenuFunctionsj }); // tao tiep transaction con var ctx = gen.GetNewEntity(); // khai bao new entity Framework var query = ctx.Transactions .Where(c => c.RoleCode == rcode && c.IsDisplay == 1 && c.IsParent == 1 && c.ParentFolder == ParentFolder).OrderBy(c => c.SortNo); foreach (var data in query) { string tcode = data.TransactionCode.Trim(); string TransactionName = data.TransactionName; BarButtonItem buttonj = new BarButtonItem(barManager1, tcode + " - " + TransactionName); subMenuFunctionsj.AddItems(new BarItem[] { buttonj }); } } } //Add the sub-menus to the bar1 bar1.AddItems(new BarItem[] { subMenuSystem }); barManager1.ItemClick += new ItemClickEventHandler(barManager1_ItemClick); barManager1.EndUpdate(); }