예제 #1
0
 public ActionResult Edit(int id, Models.AppEmployeeView collection)
 {
     try
     {
         int outputId = _dataobject.Update(collection);
         return(RedirectToAction(this.ActionReturn()));
     }
     catch (Exception ex)
     {
         Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
         return(PartialView(this._updateview, collection));
     }
 }
예제 #2
0
        public int Insert(Models.AppEmployeeView 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);

                return((int)parameters.GetValueSqlParam(this._paramnameoutput));
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        public int Update(Models.AppEmployeeView 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);

                return(data.EmployeeID);
            }
            catch (Exception)
            {
                throw;
            }
        }