private void BindAll()
    {
        try
        {
            objBudgetSection       = new BudgetSectionModel();
            objBudgetSection.Ind   = 11;
            objBudgetSection.OrgID = GlobalSession.OrgID;
            objBudgetSection.BrID  = GlobalSession.BrID;
            string    uri          = string.Format("BudgetSection/BindAll");
            DataTable dtSubSection = CommonCls.ApiPostDataTable(uri, objBudgetSection);
            if (dtSubSection.Rows.Count > 0)
            {
                grdSection.DataSource = dtSubSection;
                grdSection.DataBind();
                VSSection = dtSubSection;


                lstSeaction.DataSource     = dtSubSection;
                lstSeaction.DataTextField  = "SectionName";
                lstSeaction.DataValueField = "SectionName";
                lstSeaction.DataBind();


                //pnlSectionGrid.Visible = true;
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
示例#2
0
 internal DataTable BindAll(BudgetSectionModel ObjBudgetSectionModel)
 {
     try
     {
         ClsCon.cmd             = new SqlCommand();
         ClsCon.cmd.CommandType = CommandType.StoredProcedure;
         ClsCon.cmd.CommandText = "SPBudgetSection";
         ClsCon.cmd.Parameters.AddWithValue("@Ind", ObjBudgetSectionModel.Ind);
         ClsCon.cmd.Parameters.AddWithValue("@OrgID", ObjBudgetSectionModel.OrgID);
         ClsCon.cmd.Parameters.AddWithValue("@BrID", ObjBudgetSectionModel.BrID);
         con = ClsCon.SqlConn();
         ClsCon.cmd.Connection = con;
         dtBudgetSection       = new DataTable();
         ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
         ClsCon.da.Fill(dtBudgetSection);
         dtBudgetSection.TableName = "success";
     }
     catch (Exception)
     {
         dtBudgetSection           = new DataTable();
         dtBudgetSection.TableName = "error";
         return(dtBudgetSection);
     }
     finally
     {
         con.Close();
         con.Dispose();
         ClsCon.da.Dispose();
         ClsCon.cmd.Dispose();
     }
     return(dtBudgetSection);
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(txtSectionName.Text))
            {
                ShowMessage("Enter Group Name.", false);
                txtSectionName.Focus();
                return;
            }


            //if (!string.IsNullOrEmpty(txtSectionName.Text))
            //{
            //    if (Regex.IsMatch((txtSectionName.Text).ToUpper().Trim(), @"/^[ A-Za-z0-9-%().*/&]*$/"))
            //    {
            //        ShowMessage("Enter Valid Section Name.", false);
            //        txtSectionName.Focus();
            //        return;
            //    }
            //    else
            //    {

            //    }
            //}
            if (string.IsNullOrEmpty(txtSectionNameHindi.Text))
            {
                ShowMessage("Enter Group Name(Hindi).", false);
                txtSectionNameHindi.Focus();
                return;
            }

            if (VSSection != null)
            {
                bool IsValid = CheckSectionNameExisting();
                if (!IsValid)
                {
                    return;
                }
            }
            objBudgetSection                  = new BudgetSectionModel();
            objBudgetSection.OrgID            = GlobalSession.OrgID;
            objBudgetSection.BrID             = GlobalSession.BrID;
            objBudgetSection.User             = GlobalSession.UserID;
            objBudgetSection.IP               = GlobalSession.IP;
            objBudgetSection.SectionName      = (txtSectionName.Text).ToUpper().Trim();
            objBudgetSection.SectionNameHindi = (txtSectionNameHindi.Text).Trim();
            objBudgetSection.ParentSectionID  = 0;
            string uri;
            if (hfSectionID.Value == "0")
            {
                objBudgetSection.Ind = 1;//For Saving Data
                uri = string.Format("BudgetSection/SaveBudgetSection");
            }
            else
            {
                objBudgetSection.Ind       = 2;//For Update Data
                objBudgetSection.SectionID = CommonCls.ConvertIntZero(hfSectionID.Value);
                uri = string.Format("BudgetSection/UpdateBudgetSection");
            }

            DataTable dtSection = CommonCls.ApiPostDataTable(uri, objBudgetSection);
            if (dtSection.Rows.Count > 0)
            {
                ShowMessage("Record Save successfully.", true);
                ClearAll();
                hfSectionID.Value = "0";
                BindAll();
            }
            else
            {
                ShowMessage("Record not Save successfully.", false);
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
示例#4
0
        public DataTable DeleteBudgetSection(BudgetSectionModel ObjBudgetSectionModel)
        {
            DataTable SectionList = ObjBudgetSectionDA.DeleteBudgetSection(ObjBudgetSectionModel);

            return(SectionList);
        }
示例#5
0
        public DataTable BindAll(BudgetSectionModel ObjBudgetSectionModel)
        {
            DataTable SectionList = ObjBudgetSectionDA.BindAll(ObjBudgetSectionModel);

            return(SectionList);
        }