public ActionResult _Destroy([DataSourceRequest]DataSourceRequest request, TB_TypeViewExt model) { string Msg = ""; try { TB_TypeViewRepository modelRepo = new TB_TypeViewRepository(); if (modelRepo.Delete(model, ref Msg, this) == false) { return this.Json(new DataSourceResult { Errors = Msg }); } } catch (Exception ex) { string hostName1 = Dns.GetHostName(); string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString(); string PageName = Convert.ToString(Session["PageName"]); //string GetUserIPAddress = GetUserIPAddress1(); using (BaseRepository baseRepo = new BaseRepository()) { //BizContext BizContext1 = new BizContext(); BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress); } Session["PageName"] = ""; string error = ErrorHandling.HandleException(ex); return this.Json(new DataSourceResult { Errors = error }); } return Json(request); }
public bool Update(TB_TypeViewExt model, ref string Msg, Controller ctrl) { bool status = true; using (DBEntities DE = new DBEntities()) { var DepObj = DE.TB_TypeView.Where(x => x.ID == model.ID).FirstOrDefault(); DepObj.Name_en = model.Name_en; DepObj.Name_tr = model.Name_tr; DepObj.Name_de = model.Name_de; DepObj.Name_es = model.Name_es; DepObj.Name_fr = model.Name_fr; DepObj.Name_ru = model.Name_ru; DepObj.Name_it = model.Name_it; DepObj.Name_ar = model.Name_ar; DepObj.Name_ja = model.Name_ja; DepObj.Name_pt = model.Name_pt; DepObj.Name_zh = model.Name_zh; DepObj.IncludedInRoomTypeCaption = model.IncludeCaption; DepObj.Sort = Convert.ToInt16(model.Sorts); DepObj.Active = model.Active; DepObj.OpDateTime = DateTime.Now; DepObj.OpUserID = 0; DE.SaveChanges(); } return status; }
public List<TB_TypeViewExt> GetAllTableValue(int TableID) { List<TB_TypeViewExt> list = new List<TB_TypeViewExt>(); DataTable dt = new DataTable(); SQLCon.Open(); SqlCommand cmd = new SqlCommand("B_DisplayTable_BizTbl_Table_Sp", SQLCon); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TableID", TableID); cmd.Parameters.AddWithValue("@CultureCode", CultureCode); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(dt); SQLCon.Close(); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { TB_TypeViewExt model = new TB_TypeViewExt(); model.ID = Convert.ToInt32(dr["ID"]); model.Name_en = dr["Name_en"].ToString(); model.Name_tr = dr["Name_tr"].ToString(); model.Name_de = dr["Name_de"].ToString(); model.Name_es = dr["Name_es"].ToString(); model.Name_fr = dr["Name_fr"].ToString(); model.Name_ru = dr["Name_ru"].ToString(); model.Name_it = dr["Name_it"].ToString(); model.Name_ar = dr["Name_ar"].ToString(); model.Name_ja = dr["Name_ja"].ToString(); model.Name_pt = dr["Name_pt"].ToString(); model.Name_zh = dr["Name_zh"].ToString(); model.Sorts = dr["Sort"].ToString(); model.IncludeCaption = Convert.ToBoolean(dr["IncludedInRoomTypeCaption"]); model.Active = Convert.ToBoolean(dr["Active"]); list.Add(model); } } return list; }
public bool Delete(TB_TypeViewExt model, ref string Msg, Controller ctrl) { bool status = true; using (DBEntities DE = new DBEntities()) { var DepObj = DE.TB_TypeView.Where(x => x.ID == model.ID).FirstOrDefault(); DE.TB_TypeView.Remove(DepObj); DE.SaveChanges(); } return status; }
public bool Create(TB_TypeViewExt model, ref string Msg, Controller ctrl) { bool status = true; DBEntities insertentity = new DBEntities(); TB_TypeView DepObj = new TB_TypeView(); DepObj.Name_en = model.Name_en; DepObj.Name_tr = model.Name_tr; DepObj.Name_de = model.Name_de; DepObj.Name_es = model.Name_es; DepObj.Name_fr = model.Name_fr; DepObj.Name_ru = model.Name_ru; DepObj.Name_it = model.Name_it; DepObj.Name_ar = model.Name_ar; DepObj.Name_ja = model.Name_ja; DepObj.Name_pt = model.Name_pt; DepObj.Name_zh = model.Name_zh; DepObj.IncludedInRoomTypeCaption = model.IncludeCaption; DepObj.Sort = Convert.ToInt16(model.Sorts); DepObj.Active = model.Active; DepObj.OpDateTime = DateTime.Now; DepObj.OpUserID = 0; insertentity.TB_TypeView.Add(DepObj); insertentity.SaveChanges(); int id = DepObj.ID; return status; }