Esempio n. 1
0
        public DataSet BindGrid(Gridformsetup GP)
        {
            try
            {
                _cn.Open();
                SqlCommand _cmd = new SqlCommand("Sp_Grid_Form_Master", _cn);
                _cmd.CommandType = CommandType.StoredProcedure;
                _cmd.Parameters.AddWithValue("@tablename", GP.tablename);
                _cmd.Parameters.AddWithValue("@Corporate", GP.Corporate);
                _cmd.Parameters.AddWithValue("@unit", GP.unit);
                _cmd.Parameters.AddWithValue("@userid", GP.userid);
                _cmd.Parameters.AddWithValue("@WhereClause", GP.WhereClause);
                _cmd.Parameters.AddWithValue("@Branch", GP.Branch);
                _cmd.Parameters.AddWithValue("@PageNo", GP.PageNo);
                _cmd.Parameters.AddWithValue("@RecordsPerPage", GP.RecordsPerPage);
                _cmd.Parameters.AddWithValue("@Formcode", GP.Formcode);
                _cmd.Parameters.AddWithValue("@Formtabcode", GP.Formtabcode);
                _cmd.Parameters.AddWithValue("@type", GP.type);

                _cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
                DataSet _ds = new DataSet();
                _adp.Fill(_ds);
                _adp.Dispose();
                _cmd.Dispose();
                return _ds;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _cn.Close();
                _cn.Dispose();
            }
        }
 public ActionResult BindGridViewColumn(Gridformsetup GP)
 {
     try
     {
         DataSet ds = _objDBViewSetup.BindGridColumn(GP);
         List<ColumnGridDisplay> items = new List<ColumnGridDisplay>();
         if (ds.Tables[0].Rows.Count > 0)
         {
             ViewBag.fname = ds.Tables[0];
             foreach (System.Data.DataRow dr in ViewBag.fname.Rows)
             {
                 items.Add(new ColumnGridDisplay
                 {
                     RowNumber = dr["RowNumber"].ToString(),
                     ColumnCaption = dr["ColumnCaption"].ToString(),
                     ColumnName = dr["ColumnName"].ToString(),
                     UpdateControl = dr["UpdateControl"].ToString(),
                     srno = dr["Srno"].ToString(),
                 });
             }
         }
         var result = items;
         var rJson = Json(result, JsonRequestBehavior.AllowGet);
         rJson.MaxJsonLength = int.MaxValue;
         return rJson;
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult BindGridView(Gridformsetup GP)
 {
     try
     {
         DataSet ds = _objDBViewSetup.BindGrid(GP);
         List<GridViewsetup> items = new List<GridViewsetup>();
         if (ds.Tables[0].Rows.Count > 0)
         {
             ViewBag.fname = ds.Tables[0];
             foreach (System.Data.DataRow dr in ViewBag.fname.Rows)
             {
                 items.Add(new GridViewsetup
                 {
                     RowNumber = dr["RowNumber"].ToString(),
                     Corporate = dr["Corporate"].ToString(),
                     Screen = dr["Screen"].ToString(),
                     Module = dr["Module"].ToString(),
                     FormName = dr["FormCode"].ToString(),
                     Tab = dr["TabCode"].ToString(),
                     View = dr["ViewName"].ToString(),
                     srno = dr["Srno"].ToString(),
                 });
             }
         }
         var result = items;
         var rJson = Json(result, JsonRequestBehavior.AllowGet);
         rJson.MaxJsonLength = int.MaxValue;
         return rJson;
     }
     catch (Exception)
     {
         throw;
     }
 }