public DataSet BindDropdown_BaseAccessRights(CommanFieldConditionalPara CFCP)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("sp_Base_RoleMaster", _cn);
         _cmd.CommandType = CommandType.StoredProcedure;
         _cmd.Parameters.AddWithValue("@Module", CFCP.Module);
         _cmd.Parameters.AddWithValue("@screen", CFCP.screen);
         _cmd.Parameters.AddWithValue("@FormCode", CFCP.FormCode);
         _cmd.Parameters.AddWithValue("@TabCode", CFCP.TabCode);
         _cmd.Parameters.AddWithValue("@Corporate", CFCP.Corporate);
         _cmd.Parameters.AddWithValue("@unit", CFCP.unit);
         _cmd.Parameters.AddWithValue("@Branch", CFCP.Branch);
         _cmd.Parameters.AddWithValue("@userid", CFCP.userid);
         _cmd.Parameters.AddWithValue("@Ip", CFCP.Ip);
         _cmd.Parameters.AddWithValue("@Type", CFCP.Type);
         _cmd.Parameters.AddWithValue("@field1", CFCP.field1);
         _cmd.Parameters.AddWithValue("@field2", CFCP.field2);
         _cmd.Parameters.AddWithValue("@field3", CFCP.field3);
         _cmd.Parameters.AddWithValue("@field4", CFCP.field4);
         _cmd.Parameters.AddWithValue("@field5", CFCP.field5);
         _cmd.Parameters.AddWithValue("@Control", CFCP.Control);
         _cmd.Parameters.AddWithValue("@Srno", CFCP.Srno);
         _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 BindDropdown_BaseAccessRights(CommanFieldConditionalPara CFP)
 {
     try
     {
         DataSet ds = _objRoleRightsDb.BindDropdown_BaseAccessRights(CFP);
         List<CommanDropdown> List = new List<CommanDropdown>();
         if (ds.Tables[0].Rows.Count > 0)
         {
             ViewBag.fname = ds.Tables[0];
             foreach (System.Data.DataRow dr in ViewBag.fname.Rows)
             {
                 List.Add(new CommanDropdown { Text = @dr["xname"].ToString(), Value = @dr["xcode"].ToString() });
             }
         }
         var data = List;
         return Json(new { data = List }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult Check_defaultRole(CommanFieldConditionalPara CFP)
 {
     try
     {
         DataSet ds = _objWhitelabelAccessRights.BindDropdown_BaseAccessRights(CFP);
         List<UserWiseRights> items = new List<UserWiseRights>();
         if (ds.Tables[0].Rows.Count > 0)
         {
             ViewBag.fname = ds.Tables[0];
             foreach (System.Data.DataRow dr in ViewBag.fname.Rows)
             {
                 items.Add(new UserWiseRights
                 {
                     RowNumber = @dr["RowNumber"].ToString(),
                     srno = @dr["srno"].ToString(),
                     UserId = @dr["UserId"].ToString(),
                     Unit = @dr["Unit"].ToString(),
                     Location = @dr["Location"].ToString(),
                     Role = @dr["Role"].ToString(),
                     IsDefault = @dr["Isdefault"].ToString(),
                     Status = @dr["IsActive"].ToString(),
                     Name = @dr["Name"].ToString(),
                 });
             }
         }
         var result = items;
         return Json(new { data = result }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public ActionResult FillAll(CommanFieldConditionalPara CFP)
        {
            try
            {

                DataSet dsList = _objWhitelabelAccessRights.BindDropdown_BaseAccessRights(CFP);
                WhitelabelStep2 CV = new WhitelabelStep2();
                Grid _grid = new Grid();
                List<GridHearder> GridHearder = new List<GridHearder>();
                List<GridColumn> GridColumn = new List<GridColumn>();
                List<Grid> lstGrid = new List<Grid>();
                if (dsList.Tables[0].Rows.Count > 0)
                {
                    ViewBag.GridHearder = dsList.Tables[0];
                    ViewBag.GridColumn = dsList.Tables[1];


                    if (dsList.Tables[0] != null)
                    {
                        foreach (System.Data.DataRow dr in ViewBag.GridColumn.Rows)
                        {
                            GridColumn.Add(new GridColumn
                            {
                                xname = @dr["xname"].ToString(),
                                SrNo = @dr["xcode"].ToString(),
                                xlink = @dr["xlink"].ToString()
                            });
                        }
                    }

                    if (dsList.Tables[1] != null)
                    {
                        foreach (System.Data.DataRow dr in ViewBag.GridHearder.Rows)
                        {
                            GridHearder.Add(new GridHearder
                            {
                                xname = @dr["xname"].ToString(),
                                SrNo = @dr["xcode"].ToString()

                            });


                        }
                    }

                }

                _grid.GridColumn = GridColumn.ToList();
                _grid.GridHearder = GridHearder.ToList();

                lstGrid.Add(_grid);
                return Json(new { ColumnList = _grid.GridColumn, HeaderList = _grid.GridHearder }, JsonRequestBehavior.AllowGet);


            }
            catch (Exception)
            {

                throw;
            }


        }
 public DataSet BaseFormTabMaster(CommanFieldConditionalPara _CFCP)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("sp_Base_Form_Tab_Master", _cn);
         _cmd.CommandType = CommandType.StoredProcedure;
         _cmd.Parameters.AddWithValue("@Module", _CFCP.Module);
         _cmd.Parameters.AddWithValue("@screen", _CFCP.screen);
         _cmd.Parameters.AddWithValue("@FormCode", _CFCP.FormCode);
         _cmd.Parameters.AddWithValue("@TabCode", _CFCP.TabCode);
         _cmd.Parameters.AddWithValue("@Corporate", _CFCP.Corporate);
         _cmd.Parameters.AddWithValue("@unit", _CFCP.unit);
         _cmd.Parameters.AddWithValue("@Branch", _CFCP.Branch);
         _cmd.Parameters.AddWithValue("@userid", _CFCP.userid);
         _cmd.Parameters.AddWithValue("@Ip", _CFCP.Ip);
         _cmd.Parameters.AddWithValue("@Type", _CFCP.Type);
         _cmd.Parameters.AddWithValue("@field1", _CFCP.field1);
         _cmd.Parameters.AddWithValue("@field2", _CFCP.field2);
         _cmd.Parameters.AddWithValue("@field3", _CFCP.field3);
         _cmd.Parameters.AddWithValue("@field4", _CFCP.field4);
         _cmd.Parameters.AddWithValue("@field5", _CFCP.field5);
         _cmd.Parameters.AddWithValue("@Control", _CFCP.Control);
         _cmd.Parameters.AddWithValue("@srno", _CFCP.Srno);
         SqlDataAdapter adp = new SqlDataAdapter(_cmd);
         DataSet ds = new DataSet();
         adp.Fill(ds);
         adp.Dispose();
         _cmd.Dispose();
         return ds;
     }
     catch
     {
         throw;
     }
     finally
     {
         _cn.Close();
         _cn.Dispose();
     }
 }