protected void GrdReport_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int DeleteId = Convert.ToInt32(((ImageButton)GrdReport.Rows[e.RowIndex].Cells[0].FindControl("ImgBtnDelete")).CommandArgument.ToString()); if (DeleteId != 0) { Entity_Receipt.ReceiptVoucherId = DeleteId; Entity_Receipt.UserId = Convert.ToInt32(Session["UserId"]); Entity_Receipt.LoginDate = DateTime.Now; int iDelete = Obj_Receipt.DeleteReceipt(ref Entity_Receipt, out StrError); if (iDelete != 0) { Obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } } Entity_Receipt = null; Obj_Comm = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Edit(string receiptNo) { if (string.IsNullOrEmpty(receiptNo)) { return(HttpNotFound()); } else { ViewBag.ReceiptNo = receiptNo; ReceiptMaster rm = base.genericMgr.FindById <ReceiptMaster>(receiptNo); return(View(rm)); } }
public ActionResult Edit(GridCommand command, ReceiptMasterSearchModel searchModel) { if (string.IsNullOrEmpty(searchModel.ReceiptNo)) { return(HttpNotFound()); } else { ViewBag.ReceiptNo = searchModel.ReceiptNo; ReceiptMaster rm = base.genericMgr.FindById <ReceiptMaster>(searchModel.ReceiptNo); return(View(rm)); } }
public bool SaveReceipt(ReceiptModel model) { try { if (model != null) { ReceiptMaster master = new ReceiptMaster { BMRno = model.BMRno, BMRdate = model.BMRdate, Cash = model.Cash, Chequeno = model.Chequeno, Chequedate = model.Chequedate, Receivedamount = model.Receivedamount, Billno = model.Billno, Billamount = model.Billamount, TDS = model.TDS, FreightDeduction = model.FreightDeduction, Etc = model.Etc, remark = model.remark, financeeffect = model.financeeffect, IsActive = true, }; tRSEntities.ReceiptMasters.Add(master); tRSEntities.SaveChanges(); return(true); } else { return(false); } } catch (Exception) { throw; } }
protected ReceiptMaster GetObject(DataRow dr) { ReceiptMaster objReceiptMaster = new ReceiptMaster(); objReceiptMaster.Id = (dr["Id"] == DBNull.Value) ? 0 : (Int64)dr["Id"]; objReceiptMaster.ReceiptNo = (dr["ReceiptNo"] == DBNull.Value) ? 0 : (Int64)dr["ReceiptNo"]; objReceiptMaster.ReceiptDate = (dr["ReceiptDate"] == DBNull.Value) ? DateTime.MinValue : (DateTime)dr["ReceiptDate"]; objReceiptMaster.ReceivedBy = (dr["ReceivedBy"] == DBNull.Value) ? 0 : (Int32)dr["ReceivedBy"]; objReceiptMaster.TotalAmount = (dr["TotalAmount"] == DBNull.Value) ? 0 : (Decimal)dr["TotalAmount"]; return objReceiptMaster; }
protected void BtnSave_Click(object sender, EventArgs e) { DateTime dt1; String dtpFromDate = string.Empty; String Str1 = txtMonthDate.Text.Split('-')[0]; String Str2 = txtMonthDate.Text.Split('-')[1]; //string str = Convert.ToString(ddlPROPERTYTo.SelectedItem); //string[] s = str.Split('-'); int monthIndex; string desiredMonth = txtMonthDate.Text.Split('-')[0]; string[] MonthNames = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames; monthIndex = Array.IndexOf(MonthNames, desiredMonth) + 1; // dtpFromDate = Convert.ToDateTime(txtMonthDate.Text).ToString("01-MMM-yyyy"); dtpFromDate = Convert.ToDateTime(txtMonthDate.Text).ToString("01-MM-yyyy"); int InsertRow = 0, InsertRowDtls = 0, UpdateProRent = 0, UpdateProMonth = 0, UpdateRemAmt = 0; Entity_Receipt.ReceiptNo = txtVoucherNo.Text.ToUpper(); Entity_Receipt.ReceiptDate = (!string.IsNullOrEmpty(txtDate.Text)) ? Convert.ToDateTime(txtDate.Text.Trim()) : Convert.ToDateTime("01-Jan-1753"); Entity_Receipt.PartyId = Convert.ToInt32(ddlReceivedFrom.SelectedValue); Entity_Receipt.PropertyId = Convert.ToInt32(ddlPROPERTYTo.SelectedValue); string str = Convert.ToString(ddlPROPERTYTo.SelectedItem); string[] s = str.Split('-'); Entity_Receipt.VoucherAmt = Convert.ToDecimal(txtAmount.Text); Entity_Receipt.PaidAmount = Convert.ToDecimal(txtPaidAmount.Text); Entity_Receipt.RemainingAmt = Convert.ToDecimal(txtRemAmt.Text); // Entity_Receipt.ForTheMonth = (!string.IsNullOrEmpty(txtMonthDate.Text)) ? Convert.ToDateTime(txtMonthDate.Text.Trim()) : Convert.ToDateTime("01-Jan-1753"); Entity_Receipt.ForTheMonth = Convert.ToDateTime(dtpFromDate); Entity_Receipt.UnitNo = s[1]; Entity_Receipt.Narration = txtNarration.Text.ToUpper(); Entity_Receipt.UserId = Convert.ToInt32(Session["UserID"]); Entity_Receipt.LoginDate = DateTime.Now; Entity_Receipt.FortheMonthYear = txtMonthDate.Text.ToString(); InsertRow = Obj_Receipt.InsertReceiptNew(ref Entity_Receipt, out StrError); if (InsertRow > 0) { if (Convert.ToDecimal(txtRemAmt.Text) == 0) { Entity_Receipt.ReceiptVoucherId = InsertRow; UpdateProRent = Obj_Receipt.UpdatePropertRentDtls(ref Entity_Receipt, out StrError); UpdateProMonth = Obj_Receipt.UpdatePropertMonthmapping(ref Entity_Receipt, out StrError); } else { UpdateRemAmt = Obj_Receipt.UpdateAmtPropertMonthmapping(ref Entity_Receipt, out StrError); } } if (InsertRow > 0) { Obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_Receipt = null; Obj_Receipt = null; } }