コード例 #1
0
 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.ReceiptExpOutId = 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);
     }
 }
コード例 #2
0
    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("MM-01-yyyy");

        int InsertRow = 0, InsertRowDtls = 0, UpdateProRent = 0, UpdateProMonth = 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);
        Entity_Receipt.ExpenseHdId = Convert.ToInt32(ddlExpenseName.SelectedValue);
        string str = Convert.ToString(ddlPROPERTYTo.SelectedItem);

        string[] s = str.Split('-');

        Entity_Receipt.VoucherAmt = Convert.ToDecimal(txtAmount.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)
        //{

        //    Entity_Receipt.ReceiptExpOutId = InsertRow;
        //    UpdateProRent = Obj_Receipt.UpdatePropertRentDtls(ref Entity_Receipt, out StrError);

        //    UpdateProMonth = Obj_Receipt.UpdatePropertMonthmapping(ref Entity_Receipt, out StrError);
        //}

        if (InsertRow > 0)
        {
            Obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);

            MakeEmptyForm();

            Entity_Receipt = null;
            Obj_Receipt    = null;
        }
    }