public Seachcode(Viewtable Fromviewable, string tablename, string varialnew) { InitializeComponent(); this.Text = tablename; this.Fromviewable = Fromviewable; this.tablename = tablename; this.varialnew = varialnew; }
private void btcustomer_Click(object sender, EventArgs e) { // NPDanhsachnhavantai string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var rs1 = Model.MKT.DanhsachnhavantaiMKT(dc); Viewtable viewtbl = new Viewtable(rs1, dc, "DANH SÁCH NHÀ VẬN TẢI", 14, "MKT_nvt");// mã 14 là danh sach nha van tai MKT viewtbl.Show(); }
private void btmucdich_Click(object sender, EventArgs e) { // NPDanhsachnhavantai string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var rs1 = Model.MKT.DanhsachctMKT(dc); Viewtable viewtbl = new Viewtable(rs1, dc, "DANH SÁCH CHƯƠNG TRÌNH MAKETTING", 13, "MKT_CT");// mã 13 là danh sach CT MKT viewtbl.Show(); }
public SeachphieuMKT(Viewtable Fromviewable, string tablename, string valuesave) { // tkhead là tìm theo head - - tk là tìm theo detai InitializeComponent(); this.Fromviewable = Fromviewable; this.tablename = tablename; this.valuesave = valuesave; List <View.MKTselectStoreandRegion.ComboboxItem> CombomCollection2 = new List <View.MKTselectStoreandRegion.ComboboxItem>(); string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); this.dc = dc; /// // string username = Utils.getusername(); // string rightkho = Model.Username.getmaquyenkho(); View.MKTselectStoreandRegion.ComboboxItem cb1 = new View.MKTselectStoreandRegion.ComboboxItem(); cb1.Value = ""; cb1.Text = "All Regions";// + " || Example: " + item2.Example; CombomCollection2.Add(cb1); var rs3 = from pp in dc.tbl_MKT_Regions // where pp.Region == rightkho select pp; foreach (var item2 in rs3) { View.MKTselectStoreandRegion.ComboboxItem cb = new View.MKTselectStoreandRegion.ComboboxItem(); cb.Value = item2.Region.Trim(); cb.Text = item2.Region.Trim() + ": " + item2.Note.Trim().ToUpper();// + " || Example: " + item2.Example; CombomCollection2.Add(cb); } cbselect2.DataSource = CombomCollection2; cbstatusphieu.SelectedIndex = 0; // this.ststusphieu = cbstatusphieu.SelectedValue.ToString(); this.region = "";// (cbselect2.SelectedItem as View.MKTselectStoreandRegion.ComboboxItem).Value.ToString(); this.statusphieu = ""; }
private void button1_Click_1(object sender, EventArgs e) { // NPDanhsachnhavantai string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); // var rs1 = Model.MKT.danhsachkhoMKT(dc); // string storeright = Model.Username.getmaquyenkho(); var rs1 = Model.MKT.danhsachkhoMKTRight(dc); Viewtable viewtbl = new Viewtable(rs1, dc, "DANH SÁCH STORE rIGHT", 15, "MKT_kHORIGHT");// mã 15 là danh sach STORE Right viewtbl.ShowDialog(); }
private void button3_Click_1(object sender, EventArgs e) { if (this.ionumber == "") { MessageBox.Show("Please nhập IO number ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtionumber.Focus(); return; } if (txtchargetoaccount.Text == "") { MessageBox.Show("Please nhập Account charge to ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtchargetoaccount.Focus(); return; } if (txtcostcenter.Text == "") { MessageBox.Show("Please nhập Cost center ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtcostcenter.Focus(); return; } //check if payment natf đã request ? // một khách hàng 1/ 1 iio chỉ một lần request #region q List các document có trong bảng tbl_MKT_Payment_AprovalTMP không có trong bảng tbl_MKT_Payment_Aproval ! //--- string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var q = from paymenttemp in dc.tbl_MKT_Payment_AprovalTMPs where (from payment in dc.tbl_MKT_Payment_Aprovals select payment.Customercode).Contains(paymenttemp.Customercode) && (from payment in dc.tbl_MKT_Payment_Aprovals select payment.IO_number).Contains(paymenttemp.IO_number) select paymenttemp; if (q.Count() != 0) { Viewtable viewtbl = new Viewtable(q, dc, "List các payment request đã lập request rồi, please check", 100, "paymentrequest"); viewtbl.ShowDialog(); return; } var q2 = from p in dc.tbl_MKT_Payment_AprovalTMPs where p.username == username select p; if (q2.Count() == 0) { MessageBox.Show("Please nhập nhập chi tiết request ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); btiosetup.Focus(); return; } #endregion q //update head IOpayment var newpaymentrequest = (from p in dc.tbl_MKT_Payment_Aproval_heads where p.IO_number == "TMP" && p.username == username select p).FirstOrDefault(); if (newpaymentrequest != null) { newpaymentrequest.IO_number = Utils.Truncate(txtionumber.Text, 50); newpaymentrequest.payID = this.payID; newpaymentrequest.Account = Utils.Truncate(txtchargetoaccount.Text, 50); newpaymentrequest.costcenter = Utils.Truncate(txtcostcenter.Text, 50); newpaymentrequest.Requestby = username; newpaymentrequest.ProgrameIDDocno = Utils.Truncate(txtsohieuct.Text, 225); newpaymentrequest.ProgrameName = Utils.Truncate(txttenct.Text, 50); newpaymentrequest.Approval = "Not Approved"; newpaymentrequest.TotalAprovalBudget = this.totalBudget; dc.SubmitChanges(); } else { MessageBox.Show("Pleae check IO payment ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); btiosetup.Focus(); return; } // tbl_MKT_Payment_Aproval_head newpaymentrequest = new tbl_MKT_Payment_Aproval_head(); // udate payment progarme var tmprequest = from p in dc.tbl_MKT_Payment_AprovalTMPs where p.username == username select p; foreach (var item in tmprequest) { tbl_MKT_Payment_Aproval newpaymentRQ = new tbl_MKT_Payment_Aproval(); newpaymentRQ.IO_number = Utils.Truncate(txtionumber.Text, 50); newpaymentRQ.payID = this.payID; newpaymentRQ.Account = Utils.Truncate(txtchargetoaccount.Text, 50); newpaymentRQ.costcenter = Utils.Truncate(txtcostcenter.Text, 50); newpaymentRQ.Requestby = username; newpaymentRQ.AprovalBudget = item.AprovalBudget; newpaymentRQ.Customercode = item.Customercode; newpaymentRQ.CustomerName = item.CustomerName; newpaymentRQ.CustomerAddress = item.CustomerAddress; newpaymentRQ.ProgrameIDDocno = Utils.Truncate(txtsohieuct.Text, 50); newpaymentRQ.Requsestdate = txtfromdate.Value; newpaymentRQ.Approval = "Not Approved"; dc.tbl_MKT_Payment_Aprovals.InsertOnSubmit(newpaymentRQ); dc.SubmitChanges(); } MessageBox.Show("Upload payment done ! ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); blanknewpayment(); }
public MKTsanphammoi(int loai, int idsanpham, string storelocation, Viewtable Fromviewable) // int = 1 xóa; int = 2 sửa ; int = 3 tao mới; int = 4 vừa sửa+ xóa { InitializeComponent(); this.Fromviewable = Fromviewable; this.storelocation = storelocation; chon = false; // cbkhohang txtstorelocation.Text = storelocation; txtstorelocation.Enabled = false; this.storelocation = storelocation; this.id = idsanpham; if (loai == 1) // tạo mới { this.btupdate.Visible = false; this.btxoa.Visible = false; this.btnew.Visible = true; // this.txtmaNCC.Text = makhachhang; //txtitemcode.Text = idsanpham.ToString(); // txtitemcode.Enabled = false; /// } if (loai == 2) // xóa + sua { this.btnew.Visible = false; this.btxoa.Visible = false; // this.txtmaNCC.Text = makhachhang; //txtitemcode.Text = idsanpham.ToString(); // txtitemcode.Enabled = false; /// // string connection_string = Utils.getConnectionstr(); // LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); LinqtoSQLDataContext dc = this.Fromviewable.dc; var item = (from p in dc.tbl_MKT_Stockends where p.id == this.id select p).FirstOrDefault(); if (item != null) { // txttondaukysoluong.Text = item.tondksoluong.ToString(); // txtthanhtienton.Text = item.tondkthanhtien.ToString(); //txtitemcode.Text = item.ITEM_Code; txttensanpham.Text = item.MATERIAL; txtsapcode.Text = item.SAP_CODE; // txtsapcode.Enabled = false; txtdescription.Text = item.Description; txtItemcode.Text = item.ITEM_Code; txtEndstock.Text = item.END_STOCK.ToString(); if (txtItemcode.Text == "") { txtItemcode.Text = item.SAP_CODE; } txtunit.Text = item.UNIT; txtsapcode.Enabled = false; // txtstorelocation.Text = item.Store_code; // txtunit.Text = item.UNIT; // txtdescription.Text = item.Description; // txtItemcode.Text = item.ITEM_Code; txtQuantityPerPallet.Text = item.Quantity_Per_Pallet.ToString(); } } if (loai == 4) // xóa + sua { this.btnew.Visible = false; // this.txtmaNCC.Text = makhachhang; //txtitemcode.Text = idsanpham.ToString(); // txtitemcode.Enabled = false; /// string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var item = (from p in dc.tbl_MKT_Stockends where p.id == this.id select p).FirstOrDefault(); if (item != null) { // txttondaukysoluong.Text = item.tondksoluong.ToString(); // txtthanhtienton.Text = item.tondkthanhtien.ToString(); //txtitemcode.Text = item.ITEM_Code; txttensanpham.Text = item.MATERIAL; txtsapcode.Text = item.SAP_CODE; txtstorelocation.Text = item.Store_code; txtunit.Text = item.UNIT; txtdescription.Text = item.Description; txtItemcode.Text = item.ITEM_Code; txtQuantityPerPallet.Text = item.Quantity_Per_Pallet.ToString(); txtEndstock.Text = item.END_STOCK.ToString(); txtsapcode.Enabled = false; } } if (loai == 3) // tạo mới { this.btupdate.Visible = false; this.btxoa.Visible = false; } }