public ActionResult New(AD_DefinationTypes dt) { Response res = new Response(); try { AD_DefinationTypesBL wb = new AD_DefinationTypesBL(); if (dt.DefinationTypeId > 0) { wb.Insert("Edite", dt); } else { wb.Insert("New", dt); } res.Status = "success"; res.Message = "save successfully"; } catch (Exception ex) { res.Status = "danger"; res.Message = ex.Message; } return(Json(new { response = res }, JsonRequestBehavior.AllowGet)); }
public ActionResult New() { SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList(); ViewBag.PDefinationName = sl.DefinationTypes(); AD_DefinationTypes model = new AD_DefinationTypes(); return(PartialView("~/Views/DefinationType/_DefinationTypes.cshtml", model)); }
private AD_DefinationTypes DataTableToObject(DataTable dt, int Row) { AD_DefinationTypes Per = new AD_DefinationTypes(); Per.DefinationTypeId = DataType.ToInt64(dt.Rows[Row]["DefinationTypeId"].ToString()); Per.PDefinationTypeName = dt.Rows[Row]["PDefinationTypeId"].ToString(); Per.DefinationType = dt.Rows[Row]["DefinationType"].ToString(); Per.IsActive = DataType.ToBoolean(dt.Rows[Row]["IsActive"].ToString()); Per.SortOrder = (dt.Columns.Contains("SortOrder")) ? DataType.ToInt32(dt.Rows[Row]["SortOrder"].ToString()) : 0; // return(Per); }
public AD_DefinationTypes SingleDefinationType(string filter, string value) { DataTable dt = dtd.GetSingle(filter, value); AD_DefinationTypes def = new AD_DefinationTypes(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { def.DefinationType = dt.Rows[i]["DefinationType"].ToString(); def.DefinationTypeId = int.Parse(dt.Rows[i]["DefinationTypeId"].ToString()); def.PDefinationTypeId = (!string.IsNullOrEmpty(dt.Rows[i]["PDefinationTypeId"].ToString())) ? int.Parse(dt.Rows[i]["PDefinationTypeId"].ToString()) : 0; //def.IsActive = bool.Parse(dt.Rows[i]["IsActive"].ToString())? bool.Parse(dt.Rows[i]["IsActive"].ToString()) : true; def.IsActive = (Boolean)dt.Rows[i]["IsActive"]; } } return(def); }
public List <AD_DefinationTypes> ToList(string filter, string value = null) { DataTable dt = dtd.Get(filter, value); List <AD_DefinationTypes> lst = new List <AD_DefinationTypes>(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { AD_DefinationTypes def = new AD_DefinationTypes(); def.DefinationType = dt.Rows[i]["DefinationType"].ToString(); def.DefinationTypeId = int.Parse(dt.Rows[i]["DefinationTypeId"].ToString()); def.PDefinationTypeId = (!string.IsNullOrEmpty(dt.Rows[i]["PDefinationTypeId"].ToString())) ?int.Parse(dt.Rows[i]["PDefinationTypeId"].ToString()):0; lst.Add(def); } } return(lst); }
public bool add(string filter, AD_DefinationTypes dt) { SqlCommand loCommand = DataContext.OpenConnection(); try { loCommand = DataContext.SetStoredProcedure(loCommand, "AD_ManageDefinationTypes"); bool result = DataContext.ExecuteNonQuery(DataContext.AddParameters(loCommand, "@FILTER", filter, "@DefinationType", dt.DefinationType, "@DefinationTypeId", dt.DefinationTypeId, "PDefinationTypeId", dt.PDefinationTypeId, "Status", dt.IsActive)); return(result); } catch { throw; } finally { DataContext.CloseConnection(loCommand); } }
public ActionResult EditDefinationType(int Id) { AD_DefinationTypesBL db = new AD_DefinationTypesBL(); //List<AD_DefinationTypes> list = db.ToList("ALL"); SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList(); ViewBag.PDefinationName = sl.DefinationTypes(); AD_DefinationTypes model = new AD_DefinationTypes(); if (Id > 0) { AD_DefinationTypes dt = db.SingleDefinationType("Single", Id.ToString()); model.DefinationType = dt.DefinationType; model.PDefinationTypeId = dt.PDefinationTypeId; model.DefinationTypeId = dt.DefinationTypeId; model.IsActive = dt.IsActive; } return(PartialView("~/Views/DefinationType/_DefinationTypes.cshtml", model)); }
public void Insert(string Filter, AD_DefinationTypes dt) { AD_DefinationTypesDL dtdl = new AD_DefinationTypesDL(); bool resul = dtdl.add(Filter, dt); }