コード例 #1
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            DateTime date  = Convert.ToDateTime(txtFromdate.Text);
            DateTime date1 = Convert.ToDateTime(TxtToDate.Text);

            if (date > date1)
            {
                msgBox.ShowMessage("Please Select To date is large Than From Date !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);
                TxtToDate.Text = "";
                return;
            }
            if (txtinstallmentno.Text == "")
            {
                msgBox.ShowMessage("Please Enter Installment Number !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            if (txtInstallmentAmt.Text == "")
            {
                msgBox.ShowMessage("Please Enter Installment Amount !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            if (txtFromdate.Text == "")
            {
                msgBox.ShowMessage("Please Enter From Date !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            if (TxtToDate.Text == "")
            {
                msgBox.ShowMessage("Please Enter To Date !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            if (ddlCourse.SelectedValue == "")
            {
                msgBox.ShowMessage("Please Select Class !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            if (ddlAcademicYear.SelectedValue == "")
            {
                msgBox.ShowMessage("Please Select Academic Year !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);

                return;
            }
            DataSet ds = new DataSet();

            ObjEWA.Action         = "SaveInstallments";
            ObjEWA.OrgId1         = Session["OrgId"].ToString();
            ObjEWA.Class          = ddlCourse.SelectedValue;
            ObjEWA.AcademicYearId = ddlAcademicYear.SelectedValue;
            ObjEWA.installmentNo  = txtinstallmentno.Text;
            ObjEWA.installmentAmt = Convert.ToDecimal(txtInstallmentAmt.Text);
            ObjEWA.fromdate       = txtFromdate.Text;
            ObjEWA.todate         = TxtToDate.Text;
            ds = ObjBL.SaveInstallment(ObjEWA);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0][0].ToString() == "1")
                {
                    msgBox.ShowMessage("Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
                    GetInstallmentData();
                    btnNew.Enabled = true;
                }
                else
                {
                    msgBox.ShowMessage("Installment No Already Exists Use Another one !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);
                }
            }
            else
            {
                msgBox.ShowMessage("Sorry Something is Wrong !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);
            }
        }