private void BTcheckFileT_Click(object sender, EventArgs e) { if (validateForm()) { try { panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; TPSDataAccess accessPathWSS = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, "SYSMST")); string MaST = "0"; MaST = accessPathWSS.getMaSieuthi(); if (MaST == "0") { InfoMessage.HienThi("Khong lay Duoc Store ...,Vui long lien he voi Admin", "Loi ", "Thong bao", HinhAnhThongBao.LOI, NutThongBao.DONGY); return; } NetworkShareAccesser.Access("10.10.1.23", "synback", "synsgcoop"); string strStore = "000" + MaST; strStore = strStore.Substring(strStore.Length - 5, 5); _Store = strStore; FileInfo f = new FileInfo(@"\\10.10.1.23\QDLS\MM770FLR\" + "A" + strStore + @"\T1" + Ngay.Value.ToString("dd") + ".001"); FileInfo fthumuc0 = new FileInfo(@"\\10.10.1.23\QDLS\MM770FLR\" + strStore + @"\T1" + Ngay.Value.ToString("yyMMdd") + ".001"); DateTime datemodify = f.LastWriteTime; if (f.Exists && datemodify.Month == Ngay.Value.Month) { panel2.Visible = true; } else if (fthumuc0.Exists) { panel1.Visible = true; } else { panel3.Visible = true; } } catch (Exception) { throw; } } }
private void MainForm_MdiChildActivate(object sender, EventArgs e) { if (frmLogIn.Visible) { barControl.Hide(); barControl.Enabled = false; } if (!frmLogIn.Visible) { barControl.Enabled = true; barControl.Show(); txtLogIn.Caption = "Xin chào " + frmLogIn.MaNV + " - " + frmLogIn.MaST; Config._idcreate = frmLogIn.ID; Config._tennv = frmLogIn.TenNV; Config._tenst = frmLogIn.MaST; Config._MaNV = frmLogIn.ID; TPSDataAccess access = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, "SYSMST")); string MaST = "0"; MaST = access.getMaSieuthi(); storename.Caption = " WinDSS Store number: " + MaST; //XetQuyenNhanVien(frmLogIn.ID, frmLogIn.TenNV); XetQuyenNhanVien(frmLogIn.ID); } }
private void BTHienthi_Click(object sender, EventArgs e) { WaitingMsg waitingMsg = new WaitingMsg("Chương trình đang load dữ liệu!", "Please Waiting ......."); try { _tbDSGia.Clear(); copyfile(Config._pathfileWinDSS); //TPSDataAccess access = new TPSDataAccess(Path.Combine(CTLConfig._pathfileWinDSS, "INVMST")); TPSDataAccess access = new TPSDataAccess(_PathFileINVMST); TPSDataAccess accessPathWSS = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, "SYSMST")); SQLHelper helper = new SQLHelper(true); string MaST = "0"; MaST = accessPathWSS.getMaSieuthi(); _storeName = MaST; helper.AddParameterToSQLCommand("@STR", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@STR", MaST); if (MaST == "0") { InfoMessage.HienThi("Khong lay duoc StoreNumber " + MaST + " ", "Vui long lien he voi quan tri", "Loi Get StoreNumber", HinhAnhThongBao.LOI, NutThongBao.DONGY); return; } string strconf = ""; string strsale = ""; string strupc = ""; if (!radConfirAll.Checked) { strconf = " and CONF_PRICE=" + (radconfirYes.Checked ? "'Y'" : "'N'"); helper.AddParameterToSQLCommand("@ISTYPE", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISTYPE", (radconfirNo.Checked) ? "01" : "CS"); } if (!radsaleAll.Checked) { strsale = " and SELL_UNIT=" + (radsaleEA.Checked ? "'EA'" : "'KG'"); helper.AddParameterToSQLCommand("@ISLUM", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISLUM", (radsaleKG.Checked) ? radsaleKG.Text : radsaleEA.Text); } if (!radUPCALL.Checked) { strupc = " and UPC<>''"; helper.AddParameterToSQLCommand("@ISUPC", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISUPC", 1); } DataTable dt = helper.GetDatatableBySP("PRLN_spGetPricebyStore"); string sql = string.Format("Select SKU,Price,Description from INVMST where 1=1 {0}{1}{2} order by SKU", strconf, strsale, strupc); DataTable tbg = access.GetDataTable(sql); int dem = 0; foreach (DataRow dataRow in dt.Rows) { decimal p = Convert.ToDecimal(dataRow["PLNITM"].ToString()); for (int i = dem; i < tbg.Rows.Count; i++) { decimal pMMS = Convert.ToDecimal(tbg.Rows[i]["SKU"].ToString()); if (p == pMMS) { if (Convert.ToDecimal(tbg.Rows[i]["Price"]) != Convert.ToDecimal(dataRow["PLNAMT"].ToString())) { DataRow r = _tbDSGia.NewRow(); r["SKU"] = "00" + dataRow["PLNITM"].ToString(); r["Check"] = false; r["Description"] = tbg.Rows[i]["Description"].ToString(); r["Price"] = Convert.ToDecimal(dataRow["PLNAMT"].ToString()); r["PriceMMS"] = Convert.ToDecimal(tbg.Rows[i]["Price"]); _tbDSGia.Rows.Add(r); } dem = i + 1; break; } else if (pMMS > p) { dem = i; break; } } } GrDSPriceSKU.DataSource = _tbDSGia; waitingMsg.Finish(); } catch (Exception exception) { CTLError.WriteError("btLoadData ", exception.Message); waitingMsg.Finish(); return; throw; } }