Exemplo n.º 1
0
 public object creatReqZone(zoneInfo zi)
 {
     Results<string> result = new Results<string>();
        try
        {
       HelperData h = new HelperData();
       int t= h.AddZone(zi);
        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 static string creatReqZone(zoneInfo rn)
 {
     ZoneReqBLL nb = new ZoneReqBLL();
     return JsonConvert.SerializeObject(nb.creatReqZone(rn));
 }
 //Edit ZoneInfo Table
 public int EditZone(zoneInfo zi)
 {
     try
     {
         var v = from i in db.zoneInfos
                 where i.zoneCode == zi.zoneCode
                 select i;
         zoneInfo newzone = v.FirstOrDefault();
         if(newzone != null)
         {
             newzone = zi;
             db.SubmitChanges();
             return 1;
         }
         return 0;//not found
     }
     catch (Exception error)
     {
         return -1;
     }
 }
 //Add To ZoneInfo Table
 public int AddZone(zoneInfo zi)
 {
     helperSearch h = new helperSearch();
     try {
         if (h.checkUniqValue(zi.zoneName, "zoneName", "zoneInfo"))
         {
             db.zoneInfos.InsertOnSubmit(zi);
             db.SubmitChanges();
             return 1;
         }
         else
         {
             return 0;
         }
         }
     catch (Exception error)
     {
         return 3;
     }
 }
 partial void DeletezoneInfo(zoneInfo instance);
 partial void UpdatezoneInfo(zoneInfo instance);
 partial void InsertzoneInfo(zoneInfo instance);