Beispiel #1
0
 public void Delete(int LoaiCuaHangID)
 {
     DataAccess objDataAccess = new DataAccess();
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "DeleteLoaiCuaHang";
         sqlCmd.Parameters.Add("@LoaiCuaHangID", SqlDbType.Int).Value = LoaiCuaHangID;
         objDataAccess.ExecuteQuery(sqlCmd, "LoaiCuaHang");
     }
 }
Beispiel #2
0
 public void DeleteBatch(DataRow[] rowUpdate)
 {
     DataAccess objDataAccess = new DataAccess();
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "DeleteLoaiCuaHang";
         sqlCmd.Parameters.Add("@LoaiCuaHangID", SqlDbType.Int).SourceColumn = "LoaiCuaHangID";
         objDataAccess.UpdateBatch(rowUpdate, sqlCmd, dtTblMapping);
     }
 }
Beispiel #3
0
        public int CopyAndUpdateFields(int SourceID, string TenLoaiCuaHang, string Mota)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                int iID = 0;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "CopyAndUpdateFieldsLoaiCuaHang";

                sqlCmd.Parameters.Add("@SourceID", SqlDbType.Int).Value = SourceID;
                       sqlCmd.Parameters.Add("@TenLoaiCuaHang",SqlDbType.NVarChar,100).Value = TenLoaiCuaHang;

                       sqlCmd.Parameters.Add("@Mota",SqlDbType.NVarChar,200).Value = Mota;

                iID = objDataAccess.ExecuteScalar(sqlCmd);
                return  iID;
            }
        }
Beispiel #4
0
        public void UpdateFields(int CuaHangID, string TenCuaHang, string GioiThieu, int? NguoiDungID, string Email, string Anh, string DienThoaiDiDong, string DienThoaiCoDinh, string ThongTinLienHe, string DiaChi, string Website, string Fax, string YM, bool? KichHoat, int? SapXep, string Bak1, string Bak2, int? Bak3, int? Bak4, bool? Bak5, string bak6, string bak7, string bak8, int? Bak9, short? BaoDam, short? LoaiCuaHang, int? LoaiCuaHangID)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "UpdateFieldsCuaHang";

                sqlCmd.Parameters.Add("@CuaHangID", SqlDbType.Int ).Value = CuaHangID;
                       sqlCmd.Parameters.Add("@TenCuaHang",SqlDbType.NVarChar,100).Value = TenCuaHang;

                       sqlCmd.Parameters.Add("@GioiThieu",SqlDbType.NVarChar,4000).Value = GioiThieu;

                   		sqlCmd.Parameters.Add("@NguoiDungID",SqlDbType.Int).Value = NguoiDungID;

                       sqlCmd.Parameters.Add("@Email",SqlDbType.NVarChar,50).Value = Email;

                       sqlCmd.Parameters.Add("@Anh",SqlDbType.NVarChar,100).Value = Anh;

                       sqlCmd.Parameters.Add("@DienThoaiDiDong",SqlDbType.NVarChar,50).Value = DienThoaiDiDong;

                       sqlCmd.Parameters.Add("@DienThoaiCoDinh",SqlDbType.NVarChar,50).Value = DienThoaiCoDinh;

                       sqlCmd.Parameters.Add("@ThongTinLienHe",SqlDbType.NVarChar,4000).Value = ThongTinLienHe;

                       sqlCmd.Parameters.Add("@DiaChi",SqlDbType.NVarChar,200).Value = DiaChi;

                       sqlCmd.Parameters.Add("@Website",SqlDbType.NVarChar,200).Value = Website;

                       sqlCmd.Parameters.Add("@Fax",SqlDbType.NVarChar,50).Value = Fax;

                       sqlCmd.Parameters.Add("@YM",SqlDbType.NVarChar,50).Value = YM;

                   		sqlCmd.Parameters.Add("@KichHoat",SqlDbType.Bit).Value = KichHoat;

                   		sqlCmd.Parameters.Add("@SapXep",SqlDbType.Int).Value = SapXep;

                       sqlCmd.Parameters.Add("@Bak1",SqlDbType.NVarChar,50).Value = Bak1;

                       sqlCmd.Parameters.Add("@Bak2",SqlDbType.NVarChar,1000).Value = Bak2;

                   		sqlCmd.Parameters.Add("@Bak3",SqlDbType.Int).Value = Bak3;

                   		sqlCmd.Parameters.Add("@Bak4",SqlDbType.Int).Value = Bak4;

                   		sqlCmd.Parameters.Add("@Bak5",SqlDbType.Bit).Value = Bak5;

                       sqlCmd.Parameters.Add("@bak6",SqlDbType.NVarChar,50).Value = bak6;

                       sqlCmd.Parameters.Add("@bak7",SqlDbType.NVarChar,1000).Value = bak7;

                       sqlCmd.Parameters.Add("@bak8",SqlDbType.NVarChar,1000).Value = bak8;

                   		sqlCmd.Parameters.Add("@Bak9",SqlDbType.Int).Value = Bak9;

                   		sqlCmd.Parameters.Add("@BaoDam",SqlDbType.TinyInt).Value = BaoDam;

                   		sqlCmd.Parameters.Add("@LoaiCuaHang",SqlDbType.TinyInt).Value = LoaiCuaHang;

                   		sqlCmd.Parameters.Add("@LoaiCuaHangID",SqlDbType.Int).Value = LoaiCuaHangID;

                objDataAccess.ExecuteNonQuery(sqlCmd);
            }
        }
Beispiel #5
0
        public void UpdateBatch(ref DataRow[] rowUpdate)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "UpdateCuaHang";
                   		sqlCmd.Parameters.Add("@CuaHangID",SqlDbType.Int).SourceColumn = "CuaHangID";

                       sqlCmd.Parameters.Add("@TenCuaHang",SqlDbType.NVarChar,100).SourceColumn = "TenCuaHang";

                       sqlCmd.Parameters.Add("@GioiThieu",SqlDbType.NVarChar,4000).SourceColumn = "GioiThieu";

                   		sqlCmd.Parameters.Add("@NguoiDungID",SqlDbType.Int).SourceColumn = "NguoiDungID";

                       sqlCmd.Parameters.Add("@Email",SqlDbType.NVarChar,50).SourceColumn = "Email";

                       sqlCmd.Parameters.Add("@Anh",SqlDbType.NVarChar,100).SourceColumn = "Anh";

                       sqlCmd.Parameters.Add("@DienThoaiDiDong",SqlDbType.NVarChar,50).SourceColumn = "DienThoaiDiDong";

                       sqlCmd.Parameters.Add("@DienThoaiCoDinh",SqlDbType.NVarChar,50).SourceColumn = "DienThoaiCoDinh";

                       sqlCmd.Parameters.Add("@ThongTinLienHe",SqlDbType.NVarChar,4000).SourceColumn = "ThongTinLienHe";

                       sqlCmd.Parameters.Add("@DiaChi",SqlDbType.NVarChar,200).SourceColumn = "DiaChi";

                       sqlCmd.Parameters.Add("@Website",SqlDbType.NVarChar,200).SourceColumn = "Website";

                       sqlCmd.Parameters.Add("@Fax",SqlDbType.NVarChar,50).SourceColumn = "Fax";

                       sqlCmd.Parameters.Add("@YM",SqlDbType.NVarChar,50).SourceColumn = "YM";

                   		sqlCmd.Parameters.Add("@KichHoat",SqlDbType.Bit).SourceColumn = "KichHoat";

                   		sqlCmd.Parameters.Add("@SapXep",SqlDbType.Int).SourceColumn = "SapXep";

                       sqlCmd.Parameters.Add("@Bak1",SqlDbType.NVarChar,50).SourceColumn = "Bak1";

                       sqlCmd.Parameters.Add("@Bak2",SqlDbType.NVarChar,1000).SourceColumn = "Bak2";

                   		sqlCmd.Parameters.Add("@Bak3",SqlDbType.Int).SourceColumn = "Bak3";

                   		sqlCmd.Parameters.Add("@Bak4",SqlDbType.Int).SourceColumn = "Bak4";

                   		sqlCmd.Parameters.Add("@Bak5",SqlDbType.Bit).SourceColumn = "Bak5";

                       sqlCmd.Parameters.Add("@bak6",SqlDbType.NVarChar,50).SourceColumn = "bak6";

                       sqlCmd.Parameters.Add("@bak7",SqlDbType.NVarChar,1000).SourceColumn = "bak7";

                       sqlCmd.Parameters.Add("@bak8",SqlDbType.NVarChar,1000).SourceColumn = "bak8";

                   		sqlCmd.Parameters.Add("@Bak9",SqlDbType.Int).SourceColumn = "Bak9";

                   		sqlCmd.Parameters.Add("@BaoDam",SqlDbType.TinyInt).SourceColumn = "BaoDam";

                   		sqlCmd.Parameters.Add("@LoaiCuaHang",SqlDbType.TinyInt).SourceColumn = "LoaiCuaHang";

                   		sqlCmd.Parameters.Add("@LoaiCuaHangID",SqlDbType.Int).SourceColumn = "LoaiCuaHangID";

                objDataAccess.UpdateBatch(ref rowUpdate, sqlCmd, dtTblMapping);
            }
        }
Beispiel #6
0
 public DataSet SelectByNguoiDungID(int NguoiDungID)
 {
     DataAccess objDataAccess = new DataAccess();
     DataSet dsResult = new DataSet(); dsResult.Locale = CultureInfo.CurrentCulture;
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "GetCuaHangByNguoiDungID";
         sqlCmd.Parameters.Add("@NguoiDungID", SqlDbType.Int ).Value = NguoiDungID;
         dsResult = objDataAccess.ExecuteQuery(sqlCmd, "CuaHang");
         return dsResult;
     }
 }
Beispiel #7
0
 public DataSet SelectByField(string FieldName, string value, string type)
 {
     DataAccess objDataAccess = new DataAccess();
     DataSet dsResult = new DataSet();
     dsResult.Locale = CultureInfo.CurrentCulture;
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "SelectCuaHangByField";
         sqlCmd.Parameters.Add("@FieldName", SqlDbType.NVarChar).Value = FieldName;
         sqlCmd.Parameters.Add("@Value", SqlDbType.NVarChar).Value = value;
         sqlCmd.Parameters.Add("@type", SqlDbType.NVarChar).Value = type;
         dsResult = objDataAccess.ExecuteQuery(sqlCmd, "CuaHang");
         return dsResult;
     }
 }
Beispiel #8
0
 public DataSet SelectAll()
 {
     DataAccess objDataAccess = new DataAccess();
     DataSet dsResult = new DataSet();
     dsResult.Locale = CultureInfo.CurrentCulture;
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "GetCuaHang";
         dsResult = objDataAccess.ExecuteQuery(sqlCmd, "CuaHang");
         return dsResult;
     }
 }
Beispiel #9
0
        public int Insert(	string TenLoaiCuaHang ,	string Mota )
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                int iID = 0;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "InsertLoaiCuaHang";

                       sqlCmd.Parameters.Add("@TenLoaiCuaHang",SqlDbType.NVarChar,100).Value = TenLoaiCuaHang;

                       sqlCmd.Parameters.Add("@Mota",SqlDbType.NVarChar,200).Value = Mota;

                iID = objDataAccess.ExecuteScalar(sqlCmd);
                return  iID;
            }
        }
Beispiel #10
0
        public void UpdateFields(int LoaiCuaHangID, string TenLoaiCuaHang, string Mota)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "UpdateFieldsLoaiCuaHang";

                sqlCmd.Parameters.Add("@LoaiCuaHangID", SqlDbType.Int ).Value = LoaiCuaHangID;
                       sqlCmd.Parameters.Add("@TenLoaiCuaHang",SqlDbType.NVarChar,100).Value = TenLoaiCuaHang;

                       sqlCmd.Parameters.Add("@Mota",SqlDbType.NVarChar,200).Value = Mota;

                objDataAccess.ExecuteNonQuery(sqlCmd);
            }
        }
Beispiel #11
0
        public void UpdateBatch(ref DataRow[] rowUpdate)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "UpdateLoaiCuaHang";
                   		sqlCmd.Parameters.Add("@LoaiCuaHangID",SqlDbType.Int).SourceColumn = "LoaiCuaHangID";

                       sqlCmd.Parameters.Add("@TenLoaiCuaHang",SqlDbType.NVarChar,100).SourceColumn = "TenLoaiCuaHang";

                       sqlCmd.Parameters.Add("@Mota",SqlDbType.NVarChar,200).SourceColumn = "Mota";

                objDataAccess.UpdateBatch(ref rowUpdate, sqlCmd, dtTblMapping);
            }
        }
Beispiel #12
0
        public void InsertBatch(ref DataRow[] rowInsert)
        {
            DataAccess objDataAccess = new DataAccess();
            using (SqlCommand sqlCmd = new SqlCommand())
            {
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "InsertLoaiCuaHang_Ref";
                sqlCmd.Parameters.Add("@LoaiCuaHangID", SqlDbType.Int ).SourceColumn = "LoaiCuaHangID";
                sqlCmd.Parameters["@LoaiCuaHangID"].Direction = ParameterDirection.Output;
                       sqlCmd.Parameters.Add("@TenLoaiCuaHang",SqlDbType.NVarChar,4).SourceColumn = "TenLoaiCuaHang";

                       sqlCmd.Parameters.Add("@Mota",SqlDbType.NVarChar,100).SourceColumn = "Mota";

                objDataAccess.UpdateBatch(ref rowInsert, sqlCmd, dtTblMapping);
            }
        }
Beispiel #13
0
 //Check User belong Units
 public DataSet UnitsPermissionCheck(int USER_ID)
 {
     //GetPermissionUserForUnits
     DataAccess objDataAccess = new DataAccess();
     DataSet dsResult = new DataSet();
     dsResult.Locale = CultureInfo.CurrentCulture;
     using (SqlCommand sqlCmd = new SqlCommand())
     {
         sqlCmd.CommandType = CommandType.StoredProcedure;
         sqlCmd.CommandText = "GetPermissionUserForUnits";
         sqlCmd.Parameters.Add("@USER_ID", SqlDbType.BigInt).Value = USER_ID;
         dsResult = objDataAccess.ExecuteQuery(sqlCmd, "PermissionUserForUnits");
         return dsResult;
     }
 }