예제 #1
0
 public int AddPostInfo(postInfo pi)
 {
     HelperSearch h = new HelperSearch();
     try
     {
         if (h.checkUniqPost(pi.postName) == 1)
         {
             db.postInfos.InsertOnSubmit(pi);
             db.SubmitChanges();
             return pi.postCode;
         }
         else
         {
             return 0;
         }
     }
     catch (Exception error)
     {
         return -1;
     }
 }
 partial void DeletepostInfo(postInfo instance);
예제 #3
0
        public int EditPostInfo(postInfo pi)
        {
            try
            {
                var v = from i in db.postInfos
                        where i.postCode == pi.postCode
                        select i;
                postInfo newPost = v.FirstOrDefault();
                if (newPost != null)
                {
                    newPost.postCode = pi.postCode;
                    newPost.postName = pi.postName;
                    newPost.raster = pi.raster;
                    newPost.description = pi.description;
             //       newPost.dateInsert = pi.dateInsert;

                    newPost.deleted = false;
                    db.SubmitChanges();
                    return 1;
                }
                return 0;//not found

            }
            catch (Exception error)
            {
                return -1;
            }
        }
 partial void InsertpostInfo(postInfo instance);
 partial void UpdatepostInfo(postInfo instance);
예제 #6
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 && 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;
        }
예제 #7
0
 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;
 }
예제 #8
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;
        }
 public static string UpdateReqPost(postInfo rn)
 {
     manageBLL mb = new manageBLL();
     return JsonConvert.SerializeObject(mb.UpdateReqPost(rn));
 }
 public static string saveReqPost(postInfo pr)
 {
     manageBLL mb = new manageBLL();
     return JsonConvert.SerializeObject(mb.saveReqPost(pr));
 }