public ActionResult Edit_data_user_preferance(UserPreferancestep1 UP)
 {
     try
     {
         DataSet ds = _objwl.Edit_data_user_preferance(UP);
         List<UserPreferancestep1> UserPreferancestep1 = new List<UserPreferancestep1>();
         if (ds.Tables[0].Rows.Count > 0)
         {
             ViewBag.fname = ds.Tables[0];
             foreach (System.Data.DataRow dr in ViewBag.fname.Rows)
             {
                 UserPreferancestep1.Add(new UserPreferancestep1
                 {
                     srno = dr["srno"].ToString(),
                     GadgetPosition = dr["GadgetPosition"].ToString(),
                     OtherPreferences = dr["OtherPreferences"].ToString(),
                     pagerow = dr["pagerow"].ToString(),
                     Corporate = dr["Corporate"].ToString()
                 });
             }
         }
         var result = UserPreferancestep1;
         return Json(new { UserPreferancestep1js = result }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public DataSet Edit_data_user_preferance(UserPreferancestep1 UP)
        {
            try
            {
                _cn.Open();
                SqlCommand _cmd = new SqlCommand("sp_Edit_White_Register_UserPreferences", _cn);
                _cmd.CommandType = CommandType.StoredProcedure;
                _cmd.Parameters.AddWithValue("@tablename", "dbo._White_Register_UserPreferences");
                _cmd.Parameters.AddWithValue("@Corporate", UP.Corporate);
                _cmd.Parameters.AddWithValue("@unit", "0");
                _cmd.Parameters.AddWithValue("@Formcode", "0");
                _cmd.Parameters.AddWithValue("@Formtabcode", "0");
                _cmd.Parameters.AddWithValue("@srno", UP.srno);
                _cmd.Parameters.AddWithValue("@Type", "EditMode");
                _cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
                DataSet _ds = new DataSet();
                _adp.Fill(_ds);
                _adp.Dispose();
                _cmd.Dispose();
                return _ds;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                _cn.Close();
                _cn.Dispose();
            }
        }
        public ActionResult insert_Data_user_preferance(UserPreferancestep1 UP)
        {
            try
            {
                DataSet ds = _objwl.insert_Data_user_preferance(UP);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    ViewBag.srno = ds.Tables[0].Rows[0]["Srno"];
                    ViewBag.Message = ds.Tables[0].Rows[0]["msg"];
                    if (ds.Tables[0].Rows[0]["Help"].ToString() == "Save" || ds.Tables[0].Rows[0]["Help"].ToString() == "Update")
                    { ViewBag.Event = "success"; }
                    else if (ds.Tables[0].Rows[0]["Help"].ToString() == "Duplicate")
                    { ViewBag.Event = "error"; }
                }
                return Json(new { srno = ViewBag.srno, Event = ViewBag.Event, responseText = ViewBag.Message }, JsonRequestBehavior.AllowGet);

            }
            catch (Exception)
            {
                throw;
            }
        }
        // insert_Data_user_preferance
        public DataSet insert_Data_user_preferance(UserPreferancestep1 UP)
        {
            try
            {
                _cn.Open();
                SqlCommand _cmd = new SqlCommand("sp_save_White_Register_UserPreferences", _cn);
                _cmd.CommandType = CommandType.StoredProcedure;
                _cmd.Parameters.AddWithValue("@srno", UP.srno);
                _cmd.Parameters.AddWithValue("@Corporate", UP.Corporate);
                _cmd.Parameters.AddWithValue("@UserId", UP.userid);
                _cmd.Parameters.AddWithValue("@GadgetPosition", UP.GadgetPosition);
                _cmd.Parameters.AddWithValue("@OtherPreferences", UP.OtherPreferences);
                _cmd.Parameters.AddWithValue("@pagerow", UP.pagerow);

                _cmd.Parameters.AddWithValue("@Attribute1", UP.Attribute1);
                _cmd.Parameters.AddWithValue("@Attribute2", UP.Attribute2);
                _cmd.Parameters.AddWithValue("@Attribute3", UP.Attribute3);
                _cmd.Parameters.AddWithValue("@Attribute4", UP.Attribute4);
                _cmd.Parameters.AddWithValue("@Attribute5", UP.Attribute5);
                _cmd.Parameters.AddWithValue("@Attribute6", UP.Attribute6);
                _cmd.Parameters.AddWithValue("@Attribute7", UP.Attribute7);
                _cmd.Parameters.AddWithValue("@Attribute8", UP.Attribute8);
                _cmd.Parameters.AddWithValue("@Attribute9", UP.Attribute9);
                _cmd.Parameters.AddWithValue("@Attribute10", UP.Attribute10);
                _cmd.Parameters.AddWithValue("@CreatedBy", UP.CreatedBy);
                _cmd.Parameters.AddWithValue("@CorpcentreBy", UP.CorpcentreBy);
                _cmd.Parameters.AddWithValue("@UnitCorpBy", UP.UnitCorpBy);
                _cmd.Parameters.AddWithValue("@TerminalBy", UP.TerminalBy);
                _cmd.Parameters.AddWithValue("@BranchBy", UP.BranchBy);
                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();
            }

        }