public ActionResult Create(Models.AppItemView collection) { try { int outputId = _dataobject.Insert(collection); return(RedirectToAction(this.ActionReturn())); } catch (Exception ex) { Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex); return(PartialView(this._updateview, collection)); } }
public ActionResult EditCurrentQuantity(int id, Decimal currentquantity) { Models.AppItemView collection = _dataobject.GetEdit(id); try { collection.CurrentQuantity = currentquantity; int outputId = _dataobject.Update(collection); return(RedirectToAction(this.ActionReturn())); } catch (Exception ex) { Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex); return(PartialView(collection)); } }
public void MapExProperty(Models.AppItemView data) { data.ItemPicture = this.GetExProperty(data.ItemID, "ItemPicture"); string currentquantity = this.GetExProperty(data.ItemID, "CurrentQuantity"); if (!string.IsNullOrEmpty(currentquantity)) { data.CurrentQuantity = Convert.ToDecimal(currentquantity); } string isolationday = this.GetExProperty(data.ItemID, "IsolationDay"); if (!string.IsNullOrEmpty(isolationday)) { data.IsolationDay = Convert.ToInt16(isolationday); } }
public int Update(Models.AppItemView data) { try { this.Validate(data); data.ModifiedBy = GlobalVariant.GetAppUser().UserID; data.ModifiedDateTime = DateTime.Now; SqlParameter pOriginal = ExConvert.ParseSqlParam(data, this._metaobject.GetMetaByColumnName(this._paramnameoutput), this._paramnameupdate); var parameters = ExConvert.Data2SqlParam(data, this._metaobject, pOriginal).ToArray(); this._db.Database.ExecuteSqlCommand(this._storeNameU, parameters); this.UpdateExProperty(data); return(data.ItemID); } catch (Exception) { throw; } }
public int Insert(Models.AppItemView data) { try { this.Validate(data); data.CreatedBy = GlobalVariant.GetAppUser().UserID; data.CreatedDateTime = DateTime.Now; SqlParameter[] parameters = ExConvert.Data2SqlParam(data, this._metaobject, this._paramnameoutput).ToArray(); this._db.Database.ExecuteSqlCommand(this._storeNameI, parameters); data.ItemID = (int)parameters.GetValueSqlParam(this._paramnameoutput); this.UpdateExProperty(data); return((int)parameters.GetValueSqlParam(this._paramnameoutput)); } catch (Exception) { throw; } }
public void UpdateExProperty(Models.AppItemView data) { this.SetExProperty(data.ItemID, "ItemPicture", data.ItemPicture); this.SetExProperty(data.ItemID, "CurrentQuantity", data.CurrentQuantity.HasValue? data.CurrentQuantity.GetValueOrDefault().ToString():null); this.SetExProperty(data.ItemID, "IsolationDay", data.IsolationDay.HasValue? data.IsolationDay.GetValueOrDefault().ToString():null); }