public int Update(Models.SysUserView data) { try { this.Validate(data); data.ModifiedBy = GlobalVariant.GetAppUser().UserID; data.ModifiedDateTime = DateTime.Now; var olddata = GetById(data.UserID); if (olddata.Name != data.Name || olddata.Password != data.Password) { data.Password = Accounting.Services.MD5.GenerateHashDigest(data.Name + data.Password); } 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.UserID); } catch (Exception) { throw; } }
public long UpdateVAT(Models.AppVPO05VATView data) { try { SqlParameter pOriginal = ExConvert.ParseSqlParam(data, this._metaobject.GetMetaByColumnName(this._paramnamevatoutput), this._paramnamevatupdate); var parameters = ExConvert.Data2SqlParam(data, this._metaobject, pOriginal).ToArray(); this._db.Database.ExecuteSqlCommand(this._storeNameVATU, parameters); return(data.DocumentVATID); } catch (Exception) { throw; } }
public int UpdateLine(Models.AppFixedAssetLineTable data) { try { SqlParameter pOriginal = ExConvert.ParseSqlParam(data, this._metaobject.GetMetaByColumnName(this._paramnamelineoutput), this._paramnamelineupdate); var parameters = ExConvert.Data2SqlParam(data, this._metaobject, pOriginal).ToArray(); this._db.Database.ExecuteSqlCommand(this._storeNameLineU, parameters); return(data.FixedAssetLineID); } catch (Exception) { throw; } }
public int Update(Models.AppExpenseTable 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.ExpenseID); } catch (Exception) { throw; } }
public long Update(Models.AppVPO05View data) { try { this.ValidateUpdate(data); this.Validate(data); data.ModifiedBy = GlobalVariant.GetAppUser().UserID; data.ModifiedDateTime = DateTime.Now; SqlParameter pOriginal = ExConvert.ParseSqlParam(data, this._metaobject.GetMetaByColumnName(this._paramnamemasteroutput), this._paramnamemasterupdate); var parameters = ExConvert.Data2SqlParam(data, this._metaobject, pOriginal).ToArray(); this._db.Database.ExecuteSqlCommand(this._storeNameU, parameters); #region X? lý line this._metaobject = Services.GlobalMeta.GetMetaObject(this._metalinename); var appvpo05lineviews = data.AppVPO05LineViews.ToList(); var appvpo05lineviewz = data.AppVPO05LineViewz.ToList(); for (int i = 0; i < appvpo05lineviews.Count; i++) { var itemz = appvpo05lineviewz[i]; var item = appvpo05lineviews[i]; if (itemz != -1) { //có 2 tru?ng h?p: 1 - thêm m?i thu?ng DocumentLineID==0, 2 - s?a d? li?u cu DocumentLineID<>0 item.DocumentID = data.DocumentID; //item.AccountDebitLineID = data.AccountDebitID; item.AccountCreditLineID = data.AccountCreditID; item.MeasureRate = item.MeasureRate ?? 1; item.Quantity = item.Quantity0 * item.MeasureRate; if (data.IsoCode == Services.GlobalVariant.GetSysOption()["IsoCode"].ToString()) { //item.Debit = 0; //item.Credit = 0; //item.ExchangeRateLine = 0; item.AmountFC = 0; } if (item.DocumentLineID == 0) { this.InsertLine(item); } else { this.UpdateLine(item); } } else { //n?u xóa có 2 tru?ng h?p : 1 - xóa d? li?u có tru?c DocumentLineID<>0, 2 - xóa d? li?u m?i thêm DocumentLineID ==0 if (item.DocumentLineID > 0) { this.DeleteLine(item.DocumentLineID); } } } #endregion #region X? lý thu? if (data.AppVPO05VATViews != null) { this._metaobject = Services.GlobalMeta.GetMetaObject(this._metavatname); var appvpo05vatviews = data.AppVPO05VATViews.ToList(); var appvpo05vatviewz = data.AppVPO05VATViewz.ToList(); for (int i = 0; i < appvpo05vatviews.Count; i++) { var itemz = appvpo05vatviewz[i]; var item = appvpo05vatviews[i]; if (itemz != -1) { //có 2 tru?ng h?p: 1 - thêm m?i thu?ng DocumentLineID==0, 2 - s?a d? li?u cu DocumentLineID<>0 item.DocumentID = data.DocumentID; //item.AccountDebitLineID = data.AccountDebitID; //item.AccountCreditLineID = data.AccountCreditID; if (data.IsoCode == Services.GlobalVariant.GetSysOption()["IsoCode"].ToString()) { item.AmountFC = 0; item.AmountVATFC = 0; } if (item.DocumentVATID == 0) { this.InsertVAT(item); } else { this.UpdateVAT(item); } } else { //n?u xóa có 2 tru?ng h?p : 1 - xóa d? li?u có tru?c DocumentLineID<>0, 2 - xóa d? li?u m?i thêm DocumentLineID ==0 if (item.DocumentVATID > 0) { this.DeleteVAT(item.DocumentVATID); } } } } #endregion this._metaobject = Services.GlobalMeta.GetMetaObject(this._metaname); Services.Voucher.PostStoreProcedure(data.VoucherID, data.DocumentID); return(data.DocumentID); } catch (Exception) { throw; } }
public int Update(Models.AppFixedAssetView 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); #region Xử lý line this._metaobject = Services.GlobalMeta.GetMetaObject(this._metalinename); var AppFixedAssetLineTables = data.AppFixedAssetLineTables.ToList(); var AppFixedAssetLineTablez = data.AppFixedAssetLineTablez.ToList(); for (int i = 0; i < AppFixedAssetLineTables.Count; i++) { var itemz = AppFixedAssetLineTablez[i]; var item = AppFixedAssetLineTables[i]; if (itemz != -1) { //có 2 trường hợp: 1 - thêm mới thường DocumentLineID==0, 2 - sửa dữ liệu cũ DocumentLineID<>0 item.FixedAssetID = data.FixedAssetID; if (item.FixedAssetLineID == 0) { this.InsertLine(item); } else { this.UpdateLine(item); } } else { //nếu xóa có 2 trường hợp : 1 - xóa dữ liệu có trước DocumentLineID<>0, 2 - xóa dữ liệu mới thêm DocumentLineID ==0 if (item.FixedAssetLineID > 0) { this.DeleteLine(item.FixedAssetLineID); } } } #endregion #region Xử lý thuế if (data.AppEquipmentTables != null) { this._metaobject = Services.GlobalMeta.GetMetaObject(this._metavatname); var AppEquipmentTables = data.AppEquipmentTables.ToList(); var AppEquipmentTablez = data.AppEquipmentTablez.ToList(); for (int i = 0; i < AppEquipmentTables.Count; i++) { var itemz = AppEquipmentTablez[i]; var item = AppEquipmentTables[i]; if (itemz != -1) { //có 2 trường hợp: 1 - thêm mới thường DocumentLineID==0, 2 - sửa dữ liệu cũ DocumentLineID<>0 item.FixedAssetID = data.FixedAssetID; if (item.EquipmentID == 0) { this.InsertVAT(item); } else { this.UpdateVAT(item); } } else { //nếu xóa có 2 trường hợp : 1 - xóa dữ liệu có trước DocumentLineID<>0, 2 - xóa dữ liệu mới thêm DocumentLineID ==0 if (item.EquipmentID > 0) { this.DeleteVAT(item.EquipmentID); } } } } #endregion return(data.FixedAssetID); } catch (Exception) { throw; } }