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.ToInt32(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 creatReq(fieldInfo rn, List<tendencyInfo> rgr)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
              //  db.Connection.Open();
              //  using (db.Transaction = db.Connection.BeginTransaction())
                rn.deleted = false;
                int t = h.AddFieldInfo(rn);
                if (t != 0)
                {
                    bool s = h.AddTendency(rgr, t);
                    if (s)
                    {
                        //  db.Transaction.Commit();
                        result.IsSuccessfull = true;
                    }
                }
                else
                {
                    result.Message = "خطا!نام رشته وارد شده قبلا در سیستم ثبت شده است";
                }
            }
            catch (Exception error)
            {
              //  db.Transaction.Rollback();
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        //public object deletePostField(int postCode)
        //{
        //    Results<DataTable> result = new Results<DataTable>();
        //    try
        //    {
        //        HelperData sHelper = new HelperData();
        //        int list = sHelper.Delete(userCode);
        //        if (list == 1)
        //        {
        //            result.Message = "";
        //            result.IsSuccessfull = true;
        //            sHelper.DeleteVahedUser(userCode);
        //        }
        //        else
        //        {
        //            result.IsSuccessfull = false;
        //        }
        //        return result;
        //    }
        //    catch
        //    {
        //        return result;
        //    }
        //}
        public object saveReqPostField(List<postFieldInfo> pfr)
        {
            Results<string> result = new Results<string>();

            try
            {
                   HelperData h = new HelperData();
                            int i = h.AddPostInfo1(pfr);
                            if (i != 0)
                            {
                                result.IsSuccessfull = true;
                            }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
        public object saveReqPost(postInfo pr)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
                pr.deleted = false;
                int postCode = h.AddPostInfo(pr);
                if (postCode != 0 && postCode != -1)
                {
                        result.IsSuccessfull = true;
                }
                else
                {
                    result.IsSuccessfull = false;
                    result.Message = "خطا!عنوان شغلی وارد شده قبلا در سیستم ثبت شده است.";
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
                // reservDB.Transaction.Rollback();
            }
            return result;
        }
        public object saveReqGrade(gradeInfo gr)
        {
            Results<string> result = new Results<string>();

                try
                {
                    HelperData h = new HelperData();
                    gr.deleted = false;
                    int postCode = h.AddGradeInfo(gr);
                    if (postCode != 0)
                    {
                        result.IsSuccessfull = true;
                    }
                    else
                    {
                        result.Message = "خطا!  مقطع تحصیلی با این نام قبلا در سیستم ثبت شده است";
                    }
                }
                catch (Exception error)
                {
                    result.IsSuccessfull = false;
                    result.Message = error.Message;
                    // reservDB.Transaction.Rollback();
                }
                return result;
        }
        public object deleteUser(int userCode)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperData sHelper = new HelperData();
                int list = sHelper.deleteUserInfo(userCode);

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

                }
                else
                {

                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
        public object deleteField(int fieldCode)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperData sHelper = new HelperData();
                int list = sHelper.deleteFieldInfo(fieldCode);

                if (list == 1)
                {
                    result.Message = "";
                   int s = sHelper.DeleteTendencyInfo(fieldCode);
                    if(s==1)
                    result.IsSuccessfull = true;

                }
                else
                {

                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
        public object creatReqUser(userInfo rn)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
                rn.pass = new CustomMembershipProvider().EncryptPassword(rn.pass);
                rn.deleted = false;

                Int16 t = h.AddUserInfo(rn);
                if (t!=0)
                {
                        result.IsSuccessfull = true;

                }
            }
            catch (Exception error)
            {

                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
 public object UpdateReqPost(postInfo rn)
 {
     Results<string> result = new Results<string>();
     try
     {
         HelperData h = new HelperData();
         int t = h.EditPostInfo(rn);
         if (t == 1)
         {
             result.IsSuccessfull = true;
         }
     }
     catch (Exception error)
     {
         result.IsSuccessfull = false;
         result.Message = error.Message;
     }
     return result;
 }
        public object UpdateReqField(List<tendencyInfo> rgr, int fieldCode)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();

                int t = h.EditTendency(fieldCode, rgr);
                if (t == 1)
                {
                    result.IsSuccessfull = true;
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
Beispiel #11
0
        public object saveReqPost(postInfo pr)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
                pr.deleted = false;
                int postCode = h.AddPostInfo(pr);
                if (postCode != 0)
                {
                        result.IsSuccessfull = true;
                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
                // reservDB.Transaction.Rollback();
            }
            return result;
        }