Пример #1
0
 //通過工作代號判斷在表中是否存在
 public HttpResponseBase GetAseldMasterAssgCount()
 {
     string json = string.Empty;
     Aseld ase = new Aseld();
     AseldMaster aseMaster = new AseldMaster();
     int count = 0;
     try
     {
         _aseldmasterMgr = new AseldMasterMgr(mySqlConnectionString);
         if (!String.IsNullOrEmpty(Request.Params["number"].ToString().Trim()))//如果是新增
         {
             aseMaster.assg_id = Request.Params["number"].ToString().Trim();
             ase.assg_id = aseMaster.assg_id;
         }
         ase.change_dtim = DateTime.Now;
         ase.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
         count = _aseldmasterMgr.SelectCount(aseMaster);
         _iasdMgr = new AseldMgr(mySqlConnectionString);
         if (count > 0)
         {//輸入的項目編號裡面有商品需要揀貨,把aseld裡面的scaned欄位初始化為0(主要在第二次揀貨時)
             _iasdMgr.UpdScaned(ase);
         }
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,data:" + count + "}";//返回json數據
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }