예제 #1
0
 public ActionResult Update(PurchaseorderInfo purchaseorderInfo)
 {
     try
     {
         purchaseorderInfo.UpdatedBy   = CurrentUserInfo.UserName;
         purchaseorderInfo.UpdatedDate = DateTime.Now;
         IPurchaseorderService purchaseorderService = UnityHelper.UnityResolve <IPurchaseorderService>();
         var data = purchaseorderService.UpdatePurchaseorder(purchaseorderInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Update PurchaseorderInfo {0},{1}", LogHelper.ChangeEntityToLog(purchaseorderInfo), data));
         if (data > 0)
         {
             return(Content("OK"));
         }
         else
         {
             return(Content("Failed"));
         }
     }
     catch (BusinessException bex)
     {
         return(Content(bex.Message));
     }
     catch (Exception ex)
     {
         LogHelper.LogError(ex, "");
         return(Content(ex.Message));
     }
 }
예제 #2
0
        public ActionResult GetPurchaseorderInfoByID(string id)
        {
            IPurchaseorderService purchaseorderService = UnityHelper.UnityResolve <IPurchaseorderService>();
            var data = purchaseorderService.GetPurchaseorderByID(id);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
 public ActionResult Delete(string deleteID)
 {
     try
     {
         IPurchaseorderService purchaseorderService = UnityHelper.UnityResolve <IPurchaseorderService>();
         var data = purchaseorderService.DeletePurchaseorder(deleteID.Split(',').ToList());
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Delete PurchaseorderInfo {0},{1}", deleteID, data));
         if (data > 0)
         {
             return(Content("OK"));
         }
         else
         {
             return(Content("Failed"));
         }
     }
     catch (BusinessException bex)
     {
         return(Content(bex.Message));
     }
     catch (Exception ex)
     {
         LogHelper.LogError(ex, "");
         return(Content(ex.Message));
     }
 }
예제 #4
0
        public void Export()
        {
            IPurchaseorderService purchaseorderService = UnityHelper.UnityResolve <IPurchaseorderService>();
            QueryEntity           qe = InitQueryEntity();

            qe.IsGetAll = true;
            var data = purchaseorderService.GetPurchaseorderByQueryList(qe);

            Export2Excel("Purchaseorder.xls", data);
        }
예제 #5
0
        public string GetAllPurchaseorder()
        {
            IPurchaseorderService tmpService = UnityHelper.UnityResolve <IPurchaseorderService>();
            var data = tmpService.GetPurchaseorderByQueryList(InitQueryEntity());

            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
            timeConverter.DateTimeFormat = ConstUtils.CONST_SHOW_DATE_FORMAT;
            var tmpdata = JsonConvert.SerializeObject(data.Tables[2], timeConverter);
            var result  = "{\"total\":" + data.Tables[1].Rows[0]["TotalRecordsCount"].ToString() + ",\"rows\":" + tmpdata + " }";

            return(result);
        }