public object DeleteZone(short zoneCode)
        {
            Results<DataTable> result = new Results<DataTable>();
               try
               {

               HelperData sHelper = new HelperData();
               int i = sHelper.DeleteZoneInfo(zoneCode);
               if (i == 1)
               {
                   result.Message = "";
                   result.IsSuccessfull = true;
               }
               else
               {
                   result.Message = "";
                   result.IsSuccessfull = false;
               }
                   return result;
               }
               catch
               {
               return result;
               }
        }
        public object deleteVahed(short vahedCode)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperData sHelper = new HelperData();
                int list = sHelper.DeleteVahedInfo(vahedCode);

                if (list == 1)
                {
                    result.Message = "";
                    result.IsSuccessfull = true;
                }
                else
                {

                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
        public Results<string> creatSoftReq(softwareInfo rn,upgrade up)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();
                rn.userCode = Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"]);
                rn.deleted = false;
                up.deleted = false;
                Int16 t = h.AddSoftwareInfo(rn);
                if (t != 0)
                {
                    result.IsSuccessfull = true;
                    up.softwareCode = rn.softwareCode;
                    h.AddUpgrade(up);

                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        public object changPass(string userName)
        {
            Results<string> result = new Results<string>();
            HelperData h = new HelperData();
            try
            {
                string  newPass = new CustomMembershipProvider().EncryptPassword(userName);
                result.Value = h.changPass(userName, newPass);
                if (result.Value != "0")
                {
                    result.IsSuccessfull = true;
                    result.Message = "";
                }
                else
                {
                    result.IsSuccessfull = false;

                }
                return result;
            }
            catch
            {
                result.IsSuccessfull = false;
                result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
                return result;
            }
        }
 public object searchUserEmail(string user, string Email)
 {
     Results<string> result = new Results<string>();
     HelperData h = new HelperData();
     try
     {
         result.Value = h.searchUserEmail(user, Email);
         if (result.Value != "0" && result.Value != "-1")
         {
             result.IsSuccessfull = true;
             result.Message = "";
         }
         else
         {
             result.IsSuccessfull = false;
             result.Message = "نام کاربری یا آدرس ایمیل وارد شده اشتباه میباشد";
         }
         return result;
     }
     catch
     {
         result.IsSuccessfull = false;
         result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
         return result;
     }
 }
        public object changePass(string oldPass, string newPass)
        {
            Results<string> result = new Results<string>();
               HelperData h = new HelperData();

               try
               {
               newPass = new CustomMembershipProvider().EncryptPassword(newPass);
               oldPass = new CustomMembershipProvider().EncryptPassword(oldPass);
               result.Value = h.changePass(oldPass, newPass, Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"]));
               if (result.Value == "1")
               {
                   result.IsSuccessfull = true;
               }
               else if (result.Value == "0")
               {
                   result.IsSuccessfull = false;
                   result.Message = "رمز عبور فعلی، اشتباه وارد شده است";
               }
               else
               {
                   result.IsSuccessfull = false;
                   result.Message = "امکان ویرایش اطلاعات نمیباشد/ خطای شماره 100";
               }
               return result;
               }
               catch (Exception error)
               {
               result.Message = error.Message;
               result.IsSuccessfull = false;
               return result;
               }
        }
        public object createUpgrade(upgrade rn)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();

                rn.deleted = false;
                bool t = h.AddUpgrade(rn);
                if (t )
                {
                    result.IsSuccessfull = true;
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
 public object creatReqVahed(vahedInfo vi)
 {
     Results<string> result = new Results<string>();
     try
     {
         HelperData h = new HelperData();
         int t = h.AddVahed(vi);
         if (t==1)
         {
             result.IsSuccessfull = true;
         }
         else if (t == 0)
         {
             result.Message = "خطا!  فیلدی با این مشخصات قبلا ثبت شده است.";
         }
     }
     catch (Exception error)
     {
         result.IsSuccessfull = false;
         result.Message = error.Message;
     }
     return result;
 }
        public object updateSoftReq(softwareInfo rn)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();
                rn.deleted = false;
                rn.userCode = Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"]);

                int t = h.EditSoftwareInfo(rn);
                if (t != 0)
                {
                    result.IsSuccessfull = true;
                  //  result.Value = rn.softwareCode.ToString();
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        public object deleteSoftware(short softwareCode)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperData sHelper = new HelperData();
                int list = sHelper.DeleteSoftwareInfo(softwareCode);

                if (list == 1)
                {

                    result.Message = "";
                    result.IsSuccessfull = true;
                    sHelper.DeleteUpgrade(softwareCode);
                }
                else
                {

                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
        public object updateUpgradeReq(upgrade rn)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();
                rn.deleted = false;

                int t = h.EditUpgrade(rn);
                if (t != 0)
                {
                    result.IsSuccessfull = true;
                    //  result.Value = rn.softwareCode.ToString();
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        public object creatReqUser(userinfo rn, List<VahedUser> rgr)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
                db.Connection.Open();
                using (db.Transaction = db.Connection.BeginTransaction())
                rn.pass = new CustomMembershipProvider().EncryptPassword(rn.pass);
                rn.deleted = false;

                Int16 t = h.AddUserInfo(rn);
                if (t!=0)
                {
                    bool s = h.AddVahedUser(rgr, t);
                    if (s)
                    {
                     //  db.Transaction.Commit();
                        result.IsSuccessfull = true;
                    }
                }

            }
            catch (Exception error)
            {
                db.Transaction.Rollback();
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        public object UpdateVahedUser(List<VahedUser> rgr, short userCode)
        {
            Results<string> result = new Results<string>();
               try
               {
               HelperData h = new HelperData();

               int t = h.EditVahedUser(userCode,rgr);
               if (t == 1)
               {
                   result.IsSuccessfull = true;
               }
               }
               catch (Exception error)
               {
               result.IsSuccessfull = false;
               result.Message = error.Message;
               }
               return result;
        }
 public object UpdateReqUser(userinfo rn)
 {
     Results<string> result = new Results<string>();
        try
        {
        HelperData h = new HelperData();
        rn.pass = new CustomMembershipProvider().EncryptPassword(rn.pass);
        int t = h.EditUserInfo(rn);
        if (t == 1)
        {
            result.IsSuccessfull = true;
        }
        }
        catch (Exception error)
        {
        result.IsSuccessfull = false;
        result.Message = error.Message;
        }
        return result;
 }
        public object deleteVahedUser(Int16 id)
        {
            Results<DataTable> result = new Results<DataTable>();
               try
               {

               HelperData sHelper = new HelperData();
               int list = sHelper.DeleteVahedUser(id);

               if (list == 1)
               {
                   result.Message = "";
                   result.IsSuccessfull = true;
               }
               else
               {

                   result.IsSuccessfull = false;
               }
               return result;
               }
               catch
               {
               return result;
               }
        }