Ejemplo n.º 1
0
        public List <DM_BoPhan> GetListBoPhan()
        {
            List <DM_BoPhan> listBoPhan = new List <DM_BoPhan>();

            SQLAdaptor = MTSQLServer.getMTSQLServer().wAdapter(SQL_ALL_BOPHAN, null, false);
            DSetMain   = new DataSet();
            SQLAdaptor.Fill(DSetMain, "DM_BOPHAN");
            DataTable dt        = DSetMain.Tables["DM_BOPHAN"];
            int       rowNumber = dt.Rows.Count;

            if (rowNumber > 0)
            {
                for (int i = 0; i < rowNumber; i++)
                {
                    string maBoPhan  = dt.Rows[i]["mabophan"].ToString();
                    string tenBoPhan = dt.Rows[i]["tenbophan"].ToString();
                    string root      = dt.Rows[i]["root"].ToString();

                    listBoPhan.Add(new DM_BoPhan()
                    {
                        mabophan = maBoPhan, tenbophan = tenBoPhan, root = root
                    });
                }
            }

            return(listBoPhan);
        }
Ejemplo n.º 2
0
 public String cmdDel_Click()
 {
     try
     {
         if (tblView.GetSelectedRowHandles() == null)
         {
             return(Utils.SELECT_ROW_TO_DELETE);
         }
         var row = grid.GetRow(tblView.GetSelectedRowHandles()[0]);
         if (row == null)
         {
             return(Utils.SELECT_ROW_TO_DELETE);
         }
         var    id     = ((System.Data.DataRowView)(row)).Row.ItemArray[0];
         String sql    = String.Format(SQL_DELETE, id);
         int    result = MTSQLServer.getMTSQLServer().wExec(sql, null, false);
         if (result == 1)
         {
             GridForm_Loaded();
             return(Utils.SAVE_DB_OK);
         }
         else
         {
             return(Utils.ERR_UPDATE_DB);
         }
     }
     catch (Exception ex) { return(ex.Message.ToString()); }
 }
Ejemplo n.º 3
0
 public void cmdAbort_Click()
 {
     try
     {
         MTSQLServer.getMTSQLServer().Abort(SQLAdaptor, DSetMain.Tables[TABLE_NAME]);
         MTGlobal.SetGridReadOnly(grid, tblView, true);
         MTGlobal.SetButtonAction(MTROLE, MTButton, "ABORT");
     }
     catch { }
 }
Ejemplo n.º 4
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.º 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 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.º 7
0
 public String GridForm_Loaded()
 {
     try{
         showWaiting("Đang nạp dữ liệu...");
         string mSQL = string.Format(SQL_LOAD_ALL);
         SQLAdaptor = MTSQLServer.getMTSQLServer().wAdapter(mSQL, null, false);
         DSetMain   = new DataSet();
         SQLAdaptor.Fill(DSetMain, TABLE_NAME);
         DataTable dt = DSetMain.Tables[TABLE_NAME];
         totalRow         = dt.Rows.Count;
         grid.ItemsSource = dt;
         MTGlobal.SetGridReadOnly(grid, tblView, true);
         MTGlobal.SetFormatGridControl(grid, tblView);
         MTGlobal.SetPermit(ref MTROLE);
         MTGlobal.SetButtonAction(MTROLE, MTButton, "INIT");
     }
     catch (Exception ex) {
         closeWaiting();
         return(ex.Message.ToString());
     }
     closeWaiting();
     return(EMPTY);
 }
Ejemplo n.º 8
0
 public String cmdSave_Click()
 {
     try{
         if (MTGlobal.MT_CURRENT_ACTION == "ADD" || MTGlobal.MT_CURRENT_ACTION == "EDIT")
         {
             if (MTSQLServer.getMTSQLServer().doSaveTable(SQLAdaptor, DSetMain.Tables[TABLE_NAME]))
             {
                 MTGlobal.SetGridReadOnly(grid, tblView, true);
                 MTGlobal.SetButtonAction(MTROLE, MTButton, "SAVE");
                 this.GridForm_Loaded();
                 return(Utils.SAVE_DB_OK);
             }
             else
             {
                 return(Utils.ERR_UPDATE_DB);
             }
         }
         return("");
     }
     catch (Exception ex) {
         return(ex.Message.ToString());
     }
 }