public string InsertRow_vanphongpham(Danhmuc_VanPhongPhamModels clParam) { logger.Start("InsertRow_vanphongpham"); string strResult = ""; try { Hashtable param = new Hashtable(); strResult = GetSequence_All("dm_seq", "dm_vanphongpham"); clParam.mavanphongpham = int.Parse(strResult); if (clParam.danhmuccha == "0") { clParam.danhmuccha = strResult; clParam.danhmucgoc = "0"; } base.InsertData(clParam, "dm_vanphongpham"); } catch (Exception ex) { strResult = "-1"; logger.Error(ex.Message); } logger.End("InsertRow_vanphongpham"); return(strResult); }
public string Save_Importdl(DataTable tblSource) { logger.Start("InsertRow_vanphongpham"); string strResult = ""; try { string ma = ""; foreach (DataRow row in tblSource.Rows) { Danhmuc_VanPhongPhamModels clParam = new Danhmuc_VanPhongPhamModels(); strResult = GetSequence_All("dm_seq", "dm_vanphongpham"); clParam.mavanphongpham = int.Parse(strResult); clParam.tenvanphongpham = row["tenvanphongpham"].ToString(); clParam.dongia = row["dongia"].ToString(); clParam.danhmuccha = row["danhmuccha"].ToString(); //clParam.ghichu = row["ghichu"].ToString(); clParam.xoa = "0"; clParam.nguoitao = 1; clParam.ngaytao = "GETDATE()"; clParam.donvitinh = row["donvitinh"].ToString(); if (clParam.danhmuccha == "0") { ma = strResult; clParam.danhmuccha = strResult; clParam.danhmucgoc = "0"; } else { clParam.danhmuccha = ma; } base.InsertData(clParam, "dm_vanphongpham"); } } catch (Exception ex) { strResult = "-1"; logger.Error(ex.Message); } logger.End("InsertRow_vanphongpham"); return(strResult); }
public bool UpdateRow_vanphongpham(Danhmuc_VanPhongPhamModels clParam) { logger.Start("UpdateRow_vanphongpham"); bool bResult = false; try { sqlMap.BeginTransaction(); Hashtable param = new Hashtable(); param["mavanphongpham"] = clParam.mavanphongpham; if (clParam.danhmuccha == "0") { clParam.danhmuccha = clParam.mavanphongpham.ToString(); clParam.danhmucgoc = "0"; } else { clParam.danhmuccha = clParam.danhmuccha.ToString(); clParam.danhmucgoc = ""; } param["tenvanphongpham"] = clParam.tenvanphongpham; param["dongia"] = clParam.dongia; param["donvitinh"] = clParam.donvitinh; param["danhmuccha"] = clParam.danhmuccha; param["danhmucgoc"] = clParam.danhmucgoc; param["ghichu"] = clParam.ghichu; param["xoa"] = "0"; param["nguoihieuchinh"] = clParam.nguoihieuchinh; sqlMap.Update("Danhmuc.UpdateRow_Vanphongpham", param); sqlMap.CommitTransaction(); bResult = true; } catch (Exception ex) { sqlMap.RollbackTransaction(); bResult = false; logger.Error(ex.Message); } logger.End("UpdateRow_vanphongpham"); return(bResult); }
public List<Danhmuc_VanPhongPhamModels> SelectRows_Danhmuccha_vpp(Danhmuc_VanPhongPhamModels clParam) { logger.Start("SelectRows_Danhmuccha_vpp"); List<Danhmuc_VanPhongPhamModels> lstResult = new List<Danhmuc_VanPhongPhamModels>(); try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); IList ilist = sqlMap.ExecuteQueryForList("Danhmuc.SelectRows_vanphongpham_cha", param); CastDataType cast = new CastDataType(); lstResult = cast.AdvanceCastDataToList<Danhmuc_VanPhongPhamModels>(ilist); } catch (Exception ex) { logger.Error("Loi ---> " + ex.Message); } logger.End("SelectRows_Danhmuccha_vpp"); return lstResult; }
public bool DeleteRows_DM_Vanphongpham(Danhmuc_VanPhongPhamModels model) { logger.Start("DeleteRows_DM_Vanphongpham"); bool lstResult = false; try { sqlMap.BeginTransaction(); Hashtable param = new Hashtable(); param = new Hashtable(); param["mavanphongpham"] = model.mavanphongpham; param["nguoihieuchinh"] = model.nguoihieuchinh; sqlMap.Update("Danhmuc.DeleteRows_DM_Vanphongpham", param); sqlMap.CommitTransaction(); lstResult = true; } catch (Exception ex) { sqlMap.RollbackTransaction(); logger.Error(ex.Message); } logger.End("DeleteRows_chucdanh"); return lstResult; }