private AccountMaster MapAccountMasterForCreate(UserMasterVM userMaster) { AccountMaster accountMaster = new AccountMaster(); accountMaster.Name = userMaster.Name; accountMaster.OpeningBalanceType = userMaster.OpeningBalanceType; accountMaster.Date = userMaster.OpeningBalanceDate; if (userMaster.OpeningBalance != null) { accountMaster.OpeningBalance = userMaster.OpeningBalance.Value; } accountMaster.CreatedBy = userMaster.CreatedBy.GetValueOrDefault(); accountMaster.CreatedDateTime = userMaster.CreatedDateTime.GetValueOrDefault(); var agm = context.AccountGroupMasters.FirstOrDefault( x => context.AccountTypeMasters.Where(atm => atm.Name.ToLower().Equals("expenses")) .Select(a => a.PKID) .Contains(x.AccountTypeFKID)); if (agm != null) { accountMaster.AccountTypeFKID = agm.AccountTypeFKID; accountMaster.AccountGroupFKID = agm.PKID; } else { var atm = context.AccountTypeMasters.Where(x => x.Name.ToLower().Equals("expenses")) .Select(a => a.PKID).FirstOrDefault(); accountMaster.AccountTypeFKID = atm; } return(accountMaster); }
public int InsertAccountMaster(AccountMaster theAccountMaster) { int ReturnValue = 0; using (SqlCommand InsertCommand = new SqlCommand()) { InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@AccountGroupID", SqlDbType.Int, theAccountMaster.AccountGroupID)); InsertCommand.Parameters.Add(GetParameter("@AccountName", SqlDbType.VarChar, theAccountMaster.AccountDescription)); //InsertCommand.Parameters.Add(GetParameter("@AccountCode", SqlDbType.VarChar, theAccountMaster.AccountCode)); InsertCommand.Parameters.Add(GetParameter("@TheCompanyID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.CompanyID)); InsertCommand.Parameters.Add(GetParameter("@TheOfficeID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.OfficeID)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; InsertCommand.CommandText = "[pAccounts_Master_Insert_New]"; //InsertCommand.CommandType = CommandType.StoredProcedure; //InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; //InsertCommand.Parameters.Add(GetParameter("@AccountDescription", SqlDbType.VarChar, theAccountMaster.AccountDescription)); //InsertCommand.Parameters.Add(GetParameter("@AccountGroupID", SqlDbType.Int, theAccountMaster.AccountGroupID)); //InsertCommand.Parameters.Add(GetParameter("@AccountCode", SqlDbType.VarChar, theAccountMaster.AccountCode)); //InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); //InsertCommand.CommandText = "pAccounts_Master_Insert"; ExecuteStoredProcedure(InsertCommand); ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString()); return(ReturnValue); } }
// GET: AccountMasters/Create public ActionResult Create() { AccountMaster accountMaster = new AccountMaster(); accountMaster.IsActive = true; return(View(accountMaster)); }
//ACCILEntities dba = new ACCILEntities(); public ActionResult Insert(int id = 0) { AccountMaster act = new AccountMaster(); List <SelectListItem> Type = new List <SelectListItem>(); Type.Add(new SelectListItem { Text = "--Select--", Value = "-1" }); ViewBag.FormReq = Type; act.compcode = SessionMaster.CompCode; if (id == 0)//Add Data in Account { var max = db.accounts.Max(i => i.acctcode); act.acctcode = Convert.ToInt16(max) + 1; } else//Edit Data in Account { act.acctcode = id; } CompxERP.Models.clsSubmitModel oSubmit = new CompxERP.Models.clsSubmitModel(); DataTable dt; dt = oSubmit.GetData("select * from usermenust where mencode =" + Request.QueryString["MenCode"] + " and menuser ="******"menaddi"]); act.menedit = Convert.ToBoolean(dt.Rows[0]["menedit"]); } return(View(act)); }
public async Task <ServiceResponseModel <VoucherMasterModel> > Delete(VoucherMasterModel delVoucherMasterModel) { ServiceResponseModel <VoucherMasterModel> serviceResponse = new ServiceResponseModel <VoucherMasterModel>(); AccountMaster accountMaster = null; try { IEnumerable <Ledger> ledgerRecords = await UnitOfWork.Ledgers.FindAsync(t => t.CompCode == delVoucherMasterModel.CompCode && t.AccYear == delVoucherMasterModel.AccYear && t.VouNo == delVoucherMasterModel.VouNo); foreach (Ledger ledger in ledgerRecords) { accountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == ledger.CompCode && a.AccYear == ledger.AccYear && a.AccountId == ledger.AccountId); if (ledger.DrCr == "1") { accountMaster.CurDr = accountMaster.CurDr.GetValueOrDefault() - ledger.Amount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } else { accountMaster.CurCr = accountMaster.CurCr.GetValueOrDefault() - ledger.Amount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } UnitOfWork.AccountMasters.Update(accountMaster); } VoucherMaster delVoucherMaster = await _context.VoucherMasters .Include(vm => vm.VoucherDetails) .Include(vm => vm.Ledgers) .Include(vm => vm.Sgst) .Include(vm => vm.Cgst) .Include(vm => vm.Igst) .Where(t => t.CompCode == delVoucherMasterModel.CompCode && t.AccYear == delVoucherMasterModel.AccYear && t.VouNo == delVoucherMasterModel.VouNo) .SingleAsync(); UnitOfWork.Ledgers.RemoveRange(delVoucherMaster.Ledgers); UnitOfWork.VoucherDetails.RemoveRange(delVoucherMaster.VoucherDetails); UnitOfWork.VoucherMasters.Remove(delVoucherMaster); await UnitOfWork.Complete(); serviceResponse.Data = delVoucherMasterModel; } catch (Exception ex) { _logger.LogError(ex.StackTrace); serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }
public static AccountMaster GetAccountMasterByAccountID(int accountID) { DataRow TheAccountMasterRow = AccountMasterDataAccess.GetInstance.GetAccountMasterByAccountID(accountID); AccountMaster TheAccountMaster = DataRowToObject(TheAccountMasterRow); return(TheAccountMaster); }
public static AccountMaster GetAccountMasterByAccountDescription(string accountDescription) { DataRow TheAccountMasterRow = AccountMasterDataAccess.GetInstance.GetAccountMasterByAccountDescription(accountDescription); AccountMaster TheAccountMaster = DataRowToObject(TheAccountMasterRow); return(TheAccountMaster); }
public void GetListAccountMaster <T>(T objFilter, ref List <T> listData) where T : class, IModel, new() { string sQuery = "GetListAccountMaster"; AccountMaster objData = objFilter as AccountMaster; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("AccountCode", "AccountCode", 8, GenericDataType.Long, ParameterDirection.Input, objData.AccountCode)); SqlConnManager.GetList <T>(sQuery, CommandType.StoredProcedure, list.ToArray(), FillAccountMasterDataFromReader, ref listData); }
public DataBaseResultSet SaveAccountMaster <T>(T objData) where T : class, IModel, new() { AccountMaster obj = objData as AccountMaster; string sQuery = "sprocAccountMasterInsertUpdateSingleItem"; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("AccountCode", "AccountCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.AccountCode)); list.Add(SqlConnManager.GetConnParameters("ICode", "ICode", 13, GenericDataType.String, ParameterDirection.Input, obj.ICode)); list.Add(SqlConnManager.GetConnParameters("AccountName", "AccountName", 50, GenericDataType.String, ParameterDirection.Input, obj.AccountName)); list.Add(SqlConnManager.GetConnParameters("Add1", "Add1", 50, GenericDataType.String, ParameterDirection.Input, obj.Add1)); list.Add(SqlConnManager.GetConnParameters("Add2", "Add2", 50, GenericDataType.String, ParameterDirection.Input, obj.Add2)); list.Add(SqlConnManager.GetConnParameters("Add3", "Add3", 50, GenericDataType.String, ParameterDirection.Input, obj.Add3)); list.Add(SqlConnManager.GetConnParameters("Add4", "Add4", 50, GenericDataType.String, ParameterDirection.Input, obj.Add4)); list.Add(SqlConnManager.GetConnParameters("CityCode", "CityCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.CityCode)); list.Add(SqlConnManager.GetConnParameters("ContactPerson", "ContactPerson", 50, GenericDataType.String, ParameterDirection.Input, obj.ContactPerson)); list.Add(SqlConnManager.GetConnParameters("Phone1", "Phone1", 50, GenericDataType.String, ParameterDirection.Input, obj.Phone1)); list.Add(SqlConnManager.GetConnParameters("Phone2", "Phone2", 50, GenericDataType.String, ParameterDirection.Input, obj.Phone2)); list.Add(SqlConnManager.GetConnParameters("Email", "Email", 50, GenericDataType.String, ParameterDirection.Input, obj.Email)); list.Add(SqlConnManager.GetConnParameters("DLNo1", "DLNo1", 50, GenericDataType.String, ParameterDirection.Input, obj.DLNo1)); list.Add(SqlConnManager.GetConnParameters("DLNo2", "DLNo2", 50, GenericDataType.String, ParameterDirection.Input, obj.DLNo2)); list.Add(SqlConnManager.GetConnParameters("VatTin", "VatTin", 50, GenericDataType.String, ParameterDirection.Input, obj.VatTin)); list.Add(SqlConnManager.GetConnParameters("VatDate", "VatDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.VatDate)); list.Add(SqlConnManager.GetConnParameters("CSTVat", "CSTVat", 50, GenericDataType.String, ParameterDirection.Input, obj.CSTVat)); list.Add(SqlConnManager.GetConnParameters("CSTVatDate", "CSTVatDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CSTVatDate)); list.Add(SqlConnManager.GetConnParameters("CashDiscount", "CashDiscount", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.CashDiscount)); list.Add(SqlConnManager.GetConnParameters("BillSeries", "BillSeries", 20, GenericDataType.String, ParameterDirection.Input, obj.BillSeries)); list.Add(SqlConnManager.GetConnParameters("BillType", "BillType", 20, GenericDataType.String, ParameterDirection.Input, obj.BillType)); list.Add(SqlConnManager.GetConnParameters("AccountType", "AccountType", 50, GenericDataType.String, ParameterDirection.Input, obj.AccountType)); list.Add(SqlConnManager.GetConnParameters("GroupCode", "GroupCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.GroupCode)); list.Add(SqlConnManager.GetConnParameters("VisitDay", "VisitDay", 21, GenericDataType.String, ParameterDirection.Input, obj.VisitDay)); list.Add(SqlConnManager.GetConnParameters("InfoID", "InfoID", 10, GenericDataType.String, ParameterDirection.Input, obj.InfoID)); list.Add(SqlConnManager.GetConnParameters("OpBalAmount", "OpBalAmount", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.OpBalAmount)); list.Add(SqlConnManager.GetConnParameters("OpSetAmount", "OpSetAmount", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.OpSetAmount)); list.Add(SqlConnManager.GetConnParameters("BalAmount", "BalAmount", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.BalAmount)); list.Add(SqlConnManager.GetConnParameters("CUser", "CUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.CUser)); list.Add(SqlConnManager.GetConnParameters("CDateTime", "CDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CDateTime)); list.Add(SqlConnManager.GetConnParameters("EUser", "EUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.EUser)); list.Add(SqlConnManager.GetConnParameters("EDateTime", "EDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.EDateTime)); list.Add(SqlConnManager.GetConnParameters("LCode", "LCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.LCode)); list.Add(SqlConnManager.GetConnParameters("DLock", "DLock", 3, GenericDataType.String, ParameterDirection.Input, obj.DLock)); list.Add(SqlConnManager.GetConnParameters("ChequeName", "ChequeName", 50, GenericDataType.String, ParameterDirection.Input, obj.ChequeName)); list.Add(SqlConnManager.GetConnParameters("LBT", "LBT", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.LBT)); list.Add(SqlConnManager.GetConnParameters("LBTNo", "LBTNo", 50, GenericDataType.String, ParameterDirection.Input, obj.LBTNo)); list.Add(SqlConnManager.GetConnParameters("LBTCat", "LBTCat", 50, GenericDataType.String, ParameterDirection.Input, obj.LBTCat)); list.Add(SqlConnManager.GetConnParameters("DueDay", "DueDay", 8, GenericDataType.Decimal, ParameterDirection.Input, obj.DueDay)); list.Add(SqlConnManager.GetConnParameters("MailFormat", "MailFormat", 50, GenericDataType.String, ParameterDirection.Input, obj.MailFormat)); list.Add(SqlConnManager.GetConnParameters("CreatedBy", "CreatedBy", 50, GenericDataType.String, ParameterDirection.Input, obj.CreatedBy)); list.Add(SqlConnManager.GetConnParameters("CreatedDate", "CreatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CreatedDate)); list.Add(SqlConnManager.GetConnParameters("LUT", "LUT", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.LUT)); list.Add(SqlConnManager.GetConnParameters("UpdateddBy", "UpdateddBy", 50, GenericDataType.String, ParameterDirection.Input, obj.UpdateddBy)); list.Add(SqlConnManager.GetConnParameters("UpdatedDate", "UpdatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.UpdatedDate)); list.Add(SqlConnManager.GetConnParameters("UpdatedCount", "UpdatedCount", 4, GenericDataType.Int, ParameterDirection.Input, obj.UpdatedCount)); list.Add(SqlConnManager.GetConnParameters("OperationFlag", "OperationFlag", 4, GenericDataType.Int, ParameterDirection.Input, (short)obj.OperationFlag)); list.Add(SqlConnManager.GetConnParameters("Message", "Message", 300, GenericDataType.String, ParameterDirection.Output, null)); list.Add(SqlConnManager.GetConnParameters("ErrorCode", "ErrorCode", 4, GenericDataType.Int, ParameterDirection.Output, null)); return(SqlConnManager.Save(sQuery, CommandType.StoredProcedure, list.ToArray())); }
private void FillAccountMasterDataFromReader <T>(DbDataReader DbReader, ref List <T> listData) where T : class, IModel, new() { while (DbReader.Read()) { T obj = new T(); AccountMaster objData = obj as AccountMaster; obj.FillDataFromDB(DbReader); listData.Add(obj); } }
public async Task <ServiceResponseModel <AccountMasterModel> > Add(AccountMasterModel newAccountMasterModel) { ServiceResponseModel <AccountMasterModel> serviceResponse = new ServiceResponseModel <AccountMasterModel>(); AccountMaster accounttMaster = _mapper.Map <AccountMaster>(newAccountMasterModel); await UnitOfWork.AccountMasters.AddAsync(accounttMaster); await UnitOfWork.Complete(); serviceResponse.Data = newAccountMasterModel; return(serviceResponse); }
public static List <AccountMaster> GetAccountMasterList() { List <AccountMaster> AccountMasterList = new List <AccountMaster>(); DataTable AccountMasterTable = AccountMasterDataAccess.GetInstance.GetAccountMasterList(); foreach (DataRow dr in AccountMasterTable.Rows) { AccountMaster TheAccountMaster = DataRowToObject(dr); AccountMasterList.Add(TheAccountMaster); } return(AccountMasterList); }
public int InsertRecord() { int ProcReturnValue = 0; AccountMaster TheAccount = new AccountMaster(); TheAccount.AccountGroupID = int.Parse(ddl_AccountGroup.SelectedValue); TheAccount.AccountDescription = txt_AccountName.Text; //TheAccount.AccountCode = txt_AccountCode.Text; ProcReturnValue = AccountMasterManagement.GetInstance.InsertAccountMaster(TheAccount); return(ProcReturnValue); }
public async Task <ServiceResponseModel <AccountMasterModel> > GetAccountByName(AccountMasterModel editAccountMasterModel) { ServiceResponseModel <AccountMasterModel> serviceResponse = new ServiceResponseModel <AccountMasterModel>(); AccountMaster dbAccountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == editAccountMasterModel.CompCode && a.AccYear == editAccountMasterModel.AccYear && a.Name == editAccountMasterModel.Name); AccountMasterModel accountMasterModel = _mapper.Map <AccountMasterModel>(dbAccountMaster); serviceResponse.Data = accountMasterModel; return(serviceResponse); }
public async Task <ServiceResponseModel <AccountMasterModel> > Edit(AccountMasterModel editAccountMasterModel) { ServiceResponseModel <AccountMasterModel> serviceResponse = new ServiceResponseModel <AccountMasterModel>(); AccountMaster editAccountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == editAccountMasterModel.CompCode && a.AccYear == editAccountMasterModel.AccYear && a.AccountId == editAccountMasterModel.AccountId); _mapper.Map <AccountMasterModel, AccountMaster>(editAccountMasterModel, editAccountMaster); serviceResponse.Data = editAccountMasterModel; UnitOfWork.AccountMasters.Update(editAccountMaster); await UnitOfWork.Complete(); return(serviceResponse); }
public async Task <ServiceResponseModel <AccountMasterModel> > Delete(AccountMasterModel delAccountMasterModel) { ServiceResponseModel <AccountMasterModel> serviceResponse = new ServiceResponseModel <AccountMasterModel>(); AccountMaster delAccountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == delAccountMasterModel.CompCode && a.AccYear == delAccountMasterModel.AccYear && a.AccountId == delAccountMasterModel.AccountId); UnitOfWork.AccountMasters.Remove(delAccountMaster); await UnitOfWork.Complete(); serviceResponse.Data = delAccountMasterModel; return(serviceResponse); }
// GET: AccountMasters/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccountMaster accountMaster = accountDataLayer.Find(id); if (accountMaster == null) { return(HttpNotFound()); } return(View(accountMaster)); }
public ActionResult Edit(AccountMaster accountMaster) { if (ModelState.IsValid) { if (accountMaster.AccountImage != null) { accountMaster.AccountImagePath = "~/image/" + accountMaster.AccountImage.FileName; accountMaster.AccountImage.SaveAs(Server.MapPath("~/image") + "/" + accountMaster.AccountImage.FileName); } accountDataLayer.InsertUpdate(accountMaster); accountDataLayer.GetData("Update AccountMaster set EndDate=NULL where isnull(isActive,0)=1 and AccountMasterId" + accountMaster.AccountMasterId); return(RedirectToAction("Index")); } return(View(accountMaster)); }
public ActionResult AccountDisplay(int?AccountMasterId) { if (AccountMasterId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <Collection> collection = CollectionDataLayer.ToList().Where(x => x.AccountMasterId == AccountMasterId).ToList(); AccountMaster AccountMaster = AccountDataLayer.Find(AccountMasterId); ViewBag.MonthView = AccountDataLayer.GetProcedure("MonthView @AccountMasteId=" + AccountMasterId.ToString()); if (collection == null) { return(HttpNotFound()); } return(View(AccountMaster)); }
public static AccountMaster GetAccountMasterByAccountCode(string accountCode) { AccountMaster TheAccountMaster; DataRow TheAccountMasterRow = AccountMasterDataAccess.GetInstance.GetAccountMasterByAccountCode(accountCode); if (TheAccountMasterRow != null) { TheAccountMaster = DataRowToObject(TheAccountMasterRow); } else { TheAccountMaster = new AccountMaster(); } return(TheAccountMaster); }
public bool SaveAccount(AccountModel model) { try { if (model != null) { AccountMaster master = new AccountMaster { ledgergroupname = model.ledgergroupname, nature = model.nature, ledgername = model.ledgername, PAN = model.PAN, GSTIN = model.GSTIN, accountno = model.accountno, address = model.address, city = model.city, pincode = model.pincode, state = model.state, STDcode = model.STDcode, phoneno = model.phoneno, mobileno = model.mobileno, emailid = model.emailid, emailalert = model.emailalert, mobilealert = model.mobilealert, openingbalance = model.openingbalance, openingamount = model.openingamount, applicablelocation = model.applicablelocation, remark = model.remark, costcentrename = model.costcentrename, remark1 = model.remark1, isActive = true, }; tRSEntities.AccountMasters.Add(master); tRSEntities.SaveChanges(); return(true); } else { return(false); } } catch (Exception e) { throw e; } }
public async Task <AccountMaster> CreateAccountMaster(string name, bool hasPaymentTerms, string externalIdentifier = "5372226") { AccountMasterContent content = new AccountMasterContent(); content.ExternalIdentifier = externalIdentifier; content.Name = name; content.TermsConfiguration.HasPaymentTerms = hasPaymentTerms; content.PlatformIdentifier = _platformIdentifier; AccountMaster newEntity = new AccountMaster { Contents = content }; var entity = await _context.AccountMaster.AddAsync(newEntity); return(entity); }
public ActionResult Create(AccountMaster accountMaster) { if (ModelState.IsValid) { if (accountMaster.AccountImage != null) { accountMaster.AccountImagePath = "~/image/" + accountMaster.AccountImage.FileName; accountMaster.AccountImage.SaveAs(Server.MapPath("~/image") + "/" + accountMaster.AccountImage.FileName); } accountDataLayer.InsertUpdate(accountMaster); accountDataLayer.GetData("Update AccountMaster set EndDate=NULL where isnull(isActive,0)=1 and AccountMasterId=" + accountMaster.AccountMasterId); accountDataLayer.GetProcedure("GenrateCollection @startdate='" + accountMaster.StartDate + "',@EndDate='" + DateTime.Today.ToString("dd-MMM-yyyy") + "', @AccountMasterId=" + accountMaster.AccountMasterId); return(RedirectToAction("Index")); } return(View(accountMaster)); }
public int DeleteAccountMaster(AccountMaster theAccountMaster) { int ReturnValue = 0; using (SqlCommand DeleteCommand = new SqlCommand()) { DeleteCommand.CommandType = CommandType.StoredProcedure; DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; DeleteCommand.Parameters.Add(GetParameter("@AccountID", SqlDbType.Int, theAccountMaster.AccountID)); DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); DeleteCommand.CommandText = ""; ExecuteStoredProcedure(DeleteCommand); ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString()); return(ReturnValue); } }
public UserMasterVM UpdateUser(UserMasterVM userMaster) { userMaster.ModifiedDateTime = DateTime.Now; AccountMaster accountMaster = MapAccountMasterForUpdate(userMaster); try { context.Entry(accountMaster).State = EntityState.Modified; context.Entry(Mapper.Map <UserMasterVM, UserMaster>(userMaster)).State = EntityState.Modified; context.SaveChanges(); return(userMaster); } catch (Exception ex) { throw new Exception("Update user Failed"); } }
public static AccountMaster DataRowToObject(DataRow dr) { AccountMaster TheAccountMaster = new AccountMaster(); TheAccountMaster.AccountID = int.Parse(dr["AccountID"].ToString()); TheAccountMaster.AccountCode = dr["AccountCode"].ToString(); TheAccountMaster.AccountDescription = dr["AccountDescription"].ToString(); TheAccountMaster.AccountGroupID = int.Parse(dr["AccountGroupID"].ToString()); TheAccountMaster.AccountGroupDescription = dr["AccountGroupDescription"].ToString(); TheAccountMaster.AccountGroupParentID = int.Parse(dr["AccountGroupParentID"].ToString()); //TheAccountMaster.IsPrimary = bool.Parse(dr["IsPrimary"].ToString()); //TheAccountMaster.AccessType = dr["AccessType"].ToString(); //TheAccountMaster.AnalysisFlag = dr["AnalysisFlag"].ToString(); TheAccountMaster.DisplayOrder = int.Parse(dr["DisplayOrder"].ToString()); TheAccountMaster.AccountLedgerType = dr["AccountLedgerType"].ToString(); TheAccountMaster.SocietyID = int.Parse(dr["CompanyID"].ToString()); return(TheAccountMaster); }
private AccountMaster MapAccountMasterForUpdate(UserMasterVM userMaster) { AccountMaster accountMaster = context.AccountMasters.FirstOrDefault(x => x.PKID == userMaster.AccountFKID.Value); if (accountMaster != null) { accountMaster.Name = userMaster.Name; accountMaster.OpeningBalanceType = userMaster.OpeningBalanceType; accountMaster.Date = userMaster.OpeningBalanceDate; if (userMaster.OpeningBalance != null) { accountMaster.OpeningBalance = userMaster.OpeningBalance.Value; } accountMaster.ModifiedBy = userMaster.ModifiedBy.GetValueOrDefault(); accountMaster.ModifiedDateTime = userMaster.ModifiedDateTime.GetValueOrDefault(); return(accountMaster); } return(new AccountMaster()); }
public static AccountMaster[] BindAccountMaster(string SearchAccName) { List<AccountMaster> ReadImp = new List<AccountMaster>(); string Query = "SELECT DISTINCT AccountCode, AccountName, ShortName, BranchId, BranchName, Address1, City, State, Pincode,IECode FROM View_AccountMaster where Search = '" + SearchAccName + "'"; DataSet ds = GetData(Query); if (ds.Tables["data"].Rows.Count != 0) { DataRowView item = ds.Tables[0].DefaultView[0]; AccountMaster impdts = new AccountMaster(); impdts.Importer = item["AccountName"].ToString(); impdts.IECodeNo = item["IECode"].ToString(); impdts.BranchSno = item["BranchId"].ToString(); impdts.Address = item["Address1"].ToString(); impdts.City = item["City"].ToString(); impdts.State = item["State"].ToString(); impdts.ZipCode = item["Pincode"].ToString(); impdts.ShortName = item["ShortName"].ToString(); ReadImp.Add(impdts); } return ReadImp.ToArray(); }
public UserMasterVM CreateUser(UserMasterVM userMaster) { userMaster.CreatedDateTime = DateTime.Now; AccountMaster accountMaster = MapAccountMasterForCreate(userMaster); using (TransactionScope scope = new TransactionScope()) { try { context.AccountMasters.Add(accountMaster); context.SaveChanges(); userMaster.AccountFKID = accountMaster.PKID; context.UserMasters.Add(Mapper.Map <UserMasterVM, UserMaster>(userMaster)); context.SaveChanges(); scope.Complete(); return(userMaster); } catch (Exception ex) { throw new Exception("Save user Failed"); } } }
public int UpdateAccountMaster(AccountMaster theAccountMaster) { int ReturnValue = 0; using (SqlCommand UpdateCommand = new SqlCommand()) { UpdateCommand.CommandType = CommandType.StoredProcedure; UpdateCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; UpdateCommand.Parameters.Add(GetParameter("@AccountID", SqlDbType.Int, theAccountMaster.AccountID)); UpdateCommand.Parameters.Add(GetParameter("@AccountDescription", SqlDbType.VarChar, theAccountMaster.AccountDescription)); UpdateCommand.Parameters.Add(GetParameter("@AccountGroupID", SqlDbType.Int, theAccountMaster.AccountGroupID)); //UpdateCommand.Parameters.Add(GetParameter("@ParentAccountID", SqlDbType.Int, theAccountMaster.ParentAccountID)); //UpdateCommand.Parameters.Add(GetParameter("@AccessType", SqlDbType.VarChar, theAccountMaster.AccessType)); //UpdateCommand.Parameters.Add(GetParameter("@AnalysisFlag", SqlDbType.VarChar, theAccountMaster.AnalysisFlag)); UpdateCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); UpdateCommand.CommandText = "pAccounts_Master_Update"; ExecuteStoredProcedure(UpdateCommand); ReturnValue = int.Parse(UpdateCommand.Parameters[0].Value.ToString()); return(ReturnValue); } }
public Int32 LoadAccount(String keycode) { String key = "KdQuoteFlow_RenterServices_LoadCoverages_" + keycode; Int32? account = (Int32?)CacheManager.GetData(key); if (account == null) { AccountMaster ws = new AccountMaster { Url = Environmentals.HOWebService + "/DecisionMaker/aspscript/AccountMaster.asmx" }; string result = ws.RetrieveAccountByMarketKeyCode(keycode); if (result == null) { account = 61300; //default to corporate click thru } else { account = Int32.Parse(result.Split('|')[0]); CacheManager.Add(key, account, CacheManager.ExpireEveryDayAtSix); } } return((Int32)account); }