public ActionResult <IEnumerable <ParcelOwnershipDto> > ChangeOwner([FromRoute] int parcelID, [FromBody] ParcelChangeOwnerDto parcelChangeOwnerDto) { var parcelDto = Parcel.GetByParcelID(_dbContext, parcelID); if (ThrowNotFound(parcelDto, "Parcel", parcelID, out var actionResult)) { return(actionResult); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var waterYearsToUpdate = parcelChangeOwnerDto.ApplyToSubsequentYears ? WaterYear.GetSubsequentWaterYearsInclusive(_dbContext, parcelChangeOwnerDto.EffectiveWaterYearID).Select(x => x.WaterYearID) : new List <int> { parcelChangeOwnerDto.EffectiveWaterYearID }; AccountParcelWaterYear.ChangeParcelOwnerForWaterYears(_dbContext, parcelChangeOwnerDto.ParcelID, waterYearsToUpdate, parcelChangeOwnerDto.AccountID); Parcel.UpdateParcelStatus(_dbContext, parcelChangeOwnerDto.ParcelID, parcelChangeOwnerDto.AccountID.HasValue ? (int)ParcelStatusEnum.Active : (int)ParcelStatusEnum.Inactive); //If the Parcel was in the AccountReconciliation table, we can remove it AccountReconciliation.DeleteByParcelID(_dbContext, parcelID); return(Ok()); }
protected void btnSearch_Click(object sender, EventArgs e) { Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; AccountReconciliation oAccountReconciliation = new AccountReconciliation(); JournalDAL oJournalDAL = new JournalDAL(); this.LoadUnapprovedAccRecon(); }
protected void btnAdd_Click(object sender, EventArgs e) { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); DataTable dtAccRecon = null; DataTable DtGvAccRecon = new DataTable(); if (Session[Constants.SES_ACC_RECON] != null) { dtAccRecon = ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec; } if (true) { DateTime parsedDate; string[] s = Action_flag.Split(':'); if (s.Length == 2 && s[0] == "Edit") { dtAccRecon.Rows[int.Parse(s[1])]["SPTypeID"] = ddlSPType.SelectedItem.Value; dtAccRecon.Rows[int.Parse(s[1])]["AccountNo"] = ddlAccountNo.SelectedItem.Value.Trim(); dtAccRecon.Rows[int.Parse(s[1])]["Narration"] = txtNarration.Text.Trim(); dtAccRecon.Rows[int.Parse(s[1])]["DrCr"] = ddlDrCr.SelectedItem.Value; dtAccRecon.Rows[int.Parse(s[1])]["CurrencyID"] = ddlCurrency.SelectedItem.Value; dtAccRecon.Rows[int.Parse(s[1])]["Amount"] = decimal.Parse(txtAmount.Text.Trim()); dtAccRecon.Rows[int.Parse(s[1])]["JournalType"] = 0; DateTime.TryParseExact(txtTransDate.Text, Constants.DateTimeFormats, null, System.Globalization.DateTimeStyles.None, out parsedDate); dtAccRecon.Rows[int.Parse(s[1])]["ReceiveDate"] = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy); dtAccRecon.Rows[int.Parse(s[1])]["ActionFlag"] = "UPDATE"; Action_flag = string.Empty; } else { DataRow rowAccRecon = dtAccRecon.NewRow(); DateTime.TryParseExact(txtTransDate.Text, Constants.DateTimeFormats, null, System.Globalization.DateTimeStyles.None, out parsedDate); rowAccRecon["ValueDate"] = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy); rowAccRecon["SPTypeID"] = ddlSPType.SelectedItem.Value; rowAccRecon["AccountNo"] = ddlAccountNo.SelectedItem.Value.Trim(); rowAccRecon["Narration"] = txtNarration.Text.Trim(); rowAccRecon["DrCr"] = ddlDrCr.SelectedItem.Value; rowAccRecon["CurrencyID"] = ddlCurrency.SelectedItem.Value; rowAccRecon["Amount"] = decimal.Parse(txtAmount.Text.Trim()); rowAccRecon["JournalType"] = 0; DateTime.TryParseExact(txtTransDate.Text, Constants.DateTimeFormats, null, System.Globalization.DateTimeStyles.None, out parsedDate); rowAccRecon["ReceiveDate"] = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy); rowAccRecon["ActionFlag"] = "INSERT"; dtAccRecon.Rows.Add(rowAccRecon); } //Store in Session ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec = dtAccRecon; this.SetView(dtAccRecon); } else { } }
private void doAction(string ActionType) { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); DataTable dtTmp = ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec.Clone(); dtTmp = ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec.Copy(); foreach (GridViewRow gvr in gvAccRecon.Rows) { CheckBox chk = (CheckBox)gvr.FindControl("chkSelected"); if (chk != null) { if (chk.Checked) { dtTmp.Rows[gvr.RowIndex]["ActionFlag"] = ActionType; } } } //do DB transaction oAccountReconciliation.DtAccountRec = dtTmp.Copy(); oAccountReconciliation.UserDetails = ucUserDet.UserDetail; JournalDAL oJournalDAL = new JournalDAL(); if (ActionType == "APPROVE") { if (oJournalDAL.ApproveAccJournal(oAccountReconciliation).Status) { ucMessage.OpenMessage("Successfully Approved.", Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage("Approved failure!!", Constants.MSG_TYPE_ERROR); } } else if (ActionType == "REJECT") { if (oJournalDAL.RejectAccJournal(oAccountReconciliation).Status) { ucMessage.OpenMessage("Successfully Rejected.", Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage("Reject failure!!", Constants.MSG_TYPE_ERROR); } } ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); //refresh grid view this.LoadUnapprovedAccRecon(); #region Assign Data in calculation field set //txtTotalFaceValue.Text = dTolFaceValue.ToString("N2"); #endregion }
protected void LoadUnapprovedAccRecon(string UserName, string DivisionID, string BankCodeID) { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); JournalDAL oJournalDAL = new JournalDAL(); DataTable dtTmp = ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec.Clone(); oAccountReconciliation = (AccountReconciliation)oJournalDAL.LoadUnapprovedManualAcctJournalList(string.Empty, UserName, null, null, DivisionID, BankCodeID).Return; foreach (DataRow dr in oAccountReconciliation.DtAccountRec.Rows) { DataRow rowAccRecon = dtTmp.NewRow(); rowAccRecon["ValueDate"] = dr["ValueDate"].ToString(); rowAccRecon["SeqNo"] = int.Parse(dr["SeqNo"].ToString()); rowAccRecon["AccountNo"] = dr["AccountNo"].ToString(); rowAccRecon["SPTypeID"] = dr["SPTypeID"].ToString(); rowAccRecon["Narration"] = dr["Narration"].ToString(); rowAccRecon["CurrencyID"] = dr["CurrencyID"].ToString(); rowAccRecon["Amount"] = decimal.Parse(dr["Amount"].ToString()); rowAccRecon["JournalType"] = 0; rowAccRecon["DrCr"] = dr["DrCr"].ToString(); //[DivisionID] [char](3) NOT NULL, //[BankID] [char](3) NULL, //[MakerID] [varchar](20) NULL, //[MakeDate] [datetime] NULL, //[CheckerID] [varchar](20) NULL, //[CheckDate] [datetime] NULL, //[CheckerComment] [varchar](max) NULL, rowAccRecon["DivisionID"] = (dr["DivisionID"].ToString() == string.Empty || dr["DivisionID"] == null ? string.Empty : dr["DivisionID"].ToString().Trim()); rowAccRecon["BankID"] = (dr["BankID"].ToString() == string.Empty || dr["BankID"] == null ? string.Empty : dr["BankID"].ToString().Trim()); rowAccRecon["MakerID"] = (dr["MakerID"].ToString() == string.Empty || dr["MakerID"] == null ? string.Empty : dr["MakerID"].ToString().Trim()); rowAccRecon["MakeDate"] = (dr["MakeDate"].ToString() == string.Empty || dr["MakeDate"] == null ? string.Empty : dr["MakeDate"].ToString().Trim()); rowAccRecon["ActionFlag"] = "NIL"; dtTmp.Rows.Add(rowAccRecon); } //Store template table(null) in session ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec = dtTmp.Copy(); //Set Views this.SetView(dtTmp); }
protected void btnSave_Click(object sender, EventArgs e) { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); JournalDAL oJournalDAL = new JournalDAL(); oAccountReconciliation = (AccountReconciliation)Session[Constants.SES_ACC_RECON]; oAccountReconciliation.UserDetails = ucUserDet.UserDetail; if (oJournalDAL.SaveAccJournal(oAccountReconciliation).Status) { ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR); } //finally do ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec.Clear(); this.SetView(null); //after ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); }
protected void InitializeBuffTable() { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); DataTable dtAccRecon = new DataTable(); dtAccRecon.Columns.Add(new DataColumn("ValueDate", typeof(string))); //[ValueDate] [datetime] NOT NULL, dtAccRecon.Columns.Add(new DataColumn("SeqNo", typeof(int))); //[SeqNo] [int] NOT NULL, //2 dtAccRecon.Columns.Add(new DataColumn("AccountNo", typeof(string))); //[AccountNo] [varchar](13) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("ReferenceNo", typeof(string))); //[ReferenceNo] [varchar](20) NULL, dtAccRecon.Columns.Add(new DataColumn("SPTypeID", typeof(string))); //[SPTypeID] [char](3) NULL, dtAccRecon.Columns.Add(new DataColumn("Narration", typeof(string))); //[Narration] [varchar](100) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("CurrencyID", typeof(string))); //[CurrencyID] [char](2) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("Amount", typeof(decimal))); //[Amount] [decimal](24, 2) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("JournalType", typeof(int))); //[JournalType] [smallint] NULL, dtAccRecon.Columns.Add(new DataColumn("DrCr", typeof(string))); //[DrCr] [char](1) NOT NULL, //common for bunch of record dtAccRecon.Columns.Add(new DataColumn("IsReconciled", typeof(int))); //[IsReconciled] [bit] NOT NULL, dtAccRecon.Columns.Add(new DataColumn("ReceiveDate", typeof(string))); //[ReceiveDate] [datetime] NULL, dtAccRecon.Columns.Add(new DataColumn("IsManual", typeof(int))); //[IsManual] [bit] NOT NULL, dtAccRecon.Columns.Add(new DataColumn("ManualChecker", typeof(string))); //[ManualChecker] [varchar](20) NULL, dtAccRecon.Columns.Add(new DataColumn("DownLoadBy", typeof(string))); //[DownLoadBy] [varchar](20) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("ReconBy", typeof(string))); //[ReconBy] [varchar](20) NULL, dtAccRecon.Columns.Add(new DataColumn("DivisionID", typeof(string))); //[DivisionID] [char](3) NOT NULL, dtAccRecon.Columns.Add(new DataColumn("BankID", typeof(string))); //[BankID] [char](3) NULL, dtAccRecon.Columns.Add(new DataColumn("MakerID", typeof(string))); //[MakerID] [varchar](20) NULL, dtAccRecon.Columns.Add(new DataColumn("MakeDate", typeof(string))); //[MakeDate] [datetime] NULL, //[CheckerID] [varchar](20) NULL, //[CheckDate] [datetime] NULL, //[CheckerComment] [varchar](max) NULL, dtAccRecon.Columns.Add(new DataColumn("ActionFlag", typeof(string))); oAccountReconciliation.DtAccountRec = dtAccRecon.Clone(); Session[Constants.SES_ACC_RECON] = oAccountReconciliation; }
public ActionResult <List <AccountReconciliationDto> > ListAllAccounts() { var accountReconciliationDtos = AccountReconciliation.List(_dbContext); return(accountReconciliationDtos); }
protected void LoadUnapprovedAccRecon() { AccountReconciliation oAccountReconciliation = new AccountReconciliation(); JournalDAL oJournalDAL = new JournalDAL(); DataTable dtTmp = ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec.Clone(); Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; oAccountReconciliation = (AccountReconciliation)oJournalDAL.GetAllUnapprovedAccJournal(ddlSPType.SelectedItem.Value.Trim(), ddlAccountNo.SelectedItem.Value.Trim(), ddlMaker.SelectedItem.Value.Trim(), oConfig.DivisionID, oConfig.BankCodeID).Return; foreach (DataRow dr in oAccountReconciliation.DtAccountRec.Rows) { DataRow rowAccRecon = dtTmp.NewRow(); rowAccRecon["ValueDate"] = dr["ValueDate"].ToString(); rowAccRecon["SeqNo"] = int.Parse(dr["SeqNo"].ToString()); rowAccRecon["AccountNo"] = dr["AccountNo"].ToString(); rowAccRecon["SPTypeID"] = dr["SPTypeID"].ToString(); rowAccRecon["Narration"] = dr["Narration"].ToString(); rowAccRecon["CurrencyID"] = dr["CurrencyID"].ToString(); rowAccRecon["Amount"] = decimal.Parse(dr["Amount"].ToString()); rowAccRecon["JournalType"] = 0; rowAccRecon["DrCr"] = dr["DrCr"].ToString(); //[DivisionID] [char](3) NOT NULL, //[BankID] [char](3) NULL, //[MakerID] [varchar](20) NULL, //[MakeDate] [datetime] NULL, //[CheckerID] [varchar](20) NULL, //[CheckDate] [datetime] NULL, //[CheckerComment] [varchar](max) NULL, rowAccRecon["DivisionID"] = (dr["DivisionID"].ToString() == string.Empty || dr["DivisionID"] == null ? string.Empty : dr["DivisionID"].ToString().Trim()); rowAccRecon["BankID"] = (dr["BankID"].ToString() == string.Empty || dr["BankID"] == null ? string.Empty : dr["BankID"].ToString().Trim()); rowAccRecon["MakerID"] = (dr["MakerID"].ToString() == string.Empty || dr["MakerID"] == null ? string.Empty : dr["MakerID"].ToString().Trim()); rowAccRecon["MakeDate"] = (dr["MakeDate"].ToString() == string.Empty || dr["MakeDate"] == null ? string.Empty : DateTime.Parse(dr["MakeDate"].ToString().Trim()).ToString("dd-MM-yyyy")); rowAccRecon["ActionFlag"] = "NIL"; dtTmp.Rows.Add(rowAccRecon); } gvAccRecon.DataSource = dtTmp; gvAccRecon.DataBind(); //Store in session ((AccountReconciliation)Session[Constants.SES_ACC_RECON]).DtAccountRec = dtTmp.Copy(); //Set Values object obj = new object(); if (dtTmp.Select("DrCr='D'").Length > 0) { txtNoOfDrTrans.Text = dtTmp.Select("DrCr='D'").Length.ToString(); obj = dtTmp.Compute("SUM(Amount)", "DrCr='D'"); txtTotDrAmt.Text = !DBNull.Value.Equals(obj) ? Convert.ToDecimal(obj).ToString() : "0"; } else { txtNoOfDrTrans.Text = "0"; txtTotDrAmt.Text = "0"; } if (dtTmp.Select("DrCr='C'").Length > 0) { txtNoOfCrTrans.Text = dtTmp.Select("DrCr='C'").Length.ToString(); obj = dtTmp.Compute("SUM(Amount)", "DrCr='C'"); txtTotCrAmt.Text = Convert.ToDecimal(obj).ToString(); } else { txtNoOfCrTrans.Text = "0"; txtTotCrAmt.Text = "0"; } }
public ActionResult <ParcelSimpleDto> GetAccountReconciliationParcelsByAccountID([FromRoute] int accountID) { var parcelSimpleDtos = AccountReconciliation.ListParcelsByAccountID(_dbContext, accountID); return(Ok(parcelSimpleDtos)); }