Esempio n. 1
0
        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 int AddFieldInfo(fieldInfo fi)
 {
     HelperSearch h = new HelperSearch();
     try
     {
         if (h.checkUniqField(fi.fieldName)==1)
         {
             db.fieldInfos.InsertOnSubmit(fi);
             db.SubmitChanges();
             return fi.fieldCode;
         }
         else
         {
             return 0;
         }
     }
     catch (Exception error)
     {
         return 0;
     }
 }
        public int EditFieldInfo(fieldInfo rn)
        {
            try
            {
                var v = from i in db.fieldInfos
                        where i.fieldCode == rn.fieldCode
                        select i;
                fieldInfo newPost = v.FirstOrDefault();
                if (newPost != null)
                {
                    newPost.fieldCode = rn.fieldCode;
                    newPost.fieldName = rn.fieldName;
                   // newPost.dateInsert = rn.dateInsert;
                    newPost.deleted = false;
                    db.SubmitChanges();
                    return 1;
                }
                return 0;//not found

            }
            catch (Exception error)
            {
                return -1;
            }
        }
 partial void DeletefieldInfo(fieldInfo instance);
 partial void UpdatefieldInfo(fieldInfo instance);
 partial void InsertfieldInfo(fieldInfo instance);
Esempio n. 7
0
 public object UpdateReqField(fieldInfo rn, List<tendencyInfo> rgr, int fieldCode)
 {
     Results<string> result = new Results<string>();
     try
     {
         HelperData h = new HelperData();
         int t = h.EditFieldInfo(rn);
         if (t == 1)
         {
             int a = h.EditTendency(fieldCode, rgr);
             if (a == 1)
             {
                 result.IsSuccessfull = true;
             }
         }
     }
     catch (Exception error)
     {
         result.IsSuccessfull = false;
         result.Message = error.Message;
     }
     return result;
 }
 public static string UpdateReqField(fieldInfo rn, List<tendencyInfo> rgr, int fieldCode)
 {
     manageBLL mb = new manageBLL();
     return JsonConvert.SerializeObject(mb.UpdateReqField(rn, rgr, fieldCode));
 }
 public static string creatReq(fieldInfo rn,List<tendencyInfo> rgr)
 {
     manageBLL mb = new manageBLL();
     return JsonConvert.SerializeObject(mb.creatReq(rn, rgr));
 }