Exemplo n.º 1
0
 public string GetNextOrderNumber()
 {
     Infrastructure.Response result = new Infrastructure.Response();
     try
     {
         result.Message = _app.GetNextOrderNumber();
     }
     catch (Exception ex)
     {
         result.Status  = false;
         result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(result));
 }
Exemplo n.º 2
0
 public String GetCustID_NameByUserAcct(string acct)
 {
     Infrastructure.Response result = new Infrastructure.Response();
     try
     {
         result.Message = _app.GetCustID_NameByUserAcct(acct);
     }
     catch (Exception ex)
     {
         result.Status  = false;
         result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(result));
 }
Exemplo n.º 3
0
 public string DeleteOrder(string ordID)
 {
     Infrastructure.Response result = new Infrastructure.Response();
     try
     {
         _app.DeleteOrder(ordID);
         result.Message = "删除成功!";
     }
     catch (Exception ex)
     {
         result.Status  = false;
         result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(result));
 }
Exemplo n.º 4
0
 public string UpdateOrderStatus(string ordID, string statusTo)
 {
     Infrastructure.Response result = new Infrastructure.Response();
     try
     {
         _app.UpdateOrderStatus(ordID, statusTo);
         result.Message = "操作成功!";
     }
     catch (Exception ex)
     {
         result.Status  = false;
         result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(result));
 }
Exemplo n.º 5
0
 public string SaveOrderCatch(OrderCatchVM view)
 {
     Infrastructure.Response result = new Infrastructure.Response();
     try
     {
         _app.SaveOrderCatch(view);
         result.Message = "保存成功!";
     }
     catch (Exception ex)
     {
         result.Status  = false;
         result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(result));
 }
Exemplo n.º 6
0
        public string GetUserInfo()
        {
            Infrastructure.Response result = new Infrastructure.Response();
            User usr = AuthUtil.GetCurrentUser().User;

            try
            {
                result.Message = usr.Account;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(JsonHelper.Instance.Serialize(result));
        }
Exemplo n.º 7
0
        public string IsCustomerNameExist(string custName)
        {
            CustomerApplication app = AutofacExt.GetFromFac <CustomerApplication>();

            Infrastructure.Response result = new Infrastructure.Response();
            try
            {
                result.Message = app.IsCustomerNameExist(custName).ToString();
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(JsonHelper.Instance.Serialize(result));
        }
Exemplo n.º 8
0
        public string UserRegister(Customer view)
        {
            CustomerApplication app = AutofacExt.GetFromFac <CustomerApplication>();

            Infrastructure.Response result = new Infrastructure.Response();
            try
            {
                app.Add(view);
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }
            return(JsonHelper.Instance.Serialize(result));
        }
Exemplo n.º 9
0
        public Response ImportIn(IFormFile excelfile)
        {
            Response        result    = new Infrastructure.Response();
            List <Location> exp       = imp.ConvertToModel <Location>(excelfile);
            string          sErrorMsg = "";

            for (int i = 0; i < exp.Count; i++)
            {
                try
                {
                    Location e = exp[i];
                    e.Id = null;
                    _app.Add(e);
                }
                catch (Exception ex)
                {
                    sErrorMsg     += "第" + (i + 2) + "行:" + ex.Message + "<br>";
                    result.Message = sErrorMsg;
                    break;
                }
            }
            if (sErrorMsg.Equals(string.Empty))
            {
                if (exp.Count == 0)
                {
                    sErrorMsg     += "没有发现有效数据, 请确定模板是否正确, 或是否有填充数据!";
                    result.Message = sErrorMsg;
                }
                else
                {
                    result.Message = "导入完成";
                }
            }
            else
            {
                result.Status  = false;
                result.Message = result.Message;
            }
            return(result);
        }
Exemplo n.º 10
0
        public Response UploadIForm(IFormFile file, string pcode, string scode)
        {
            string   outputDirPath = $"/OfficeFiles/";
            Response result        = new Infrastructure.Response();
            var      fileName      = file.FileName;
            String   suffixName    = fileName.Substring(fileName.LastIndexOf("."));

            Console.WriteLine(fileName);
            var newfilename = pcode + scode + suffixName;

            fileName = $"/UploadFile/{newfilename}";

            fileName = _hostingEnvironment.WebRootPath + fileName;

            using (FileStream fs = System.IO.File.Create(fileName))
            {
                file.CopyTo(fs);
                fs.Flush();
            }
            Step step = _unitWork.Find <Step>(u => u.ProductCode == pcode && u.Code == scode).FirstOrDefault();

            if (suffixName.ToUpper() == ".XLSX" || suffixName.ToUpper() == ".XLS")
            {
                ExcelPreview.Priview(fileName, pcode + scode, _hostingEnvironment.WebRootPath + outputDirPath);
                step.LinkSop = "/OfficeFiles/" + pcode + scode + ".html";
            }
            else if (suffixName.ToUpper() == ".DOC" || suffixName.ToUpper() == ".DOCX")
            {
                WordPreview.Priview(fileName, pcode + scode, _hostingEnvironment.WebRootPath + outputDirPath);
                step.LinkSop = "/OfficeFiles/" + pcode + scode + ".html";
            }
            else
            {
                step.LinkSop = "/UploadFile/" + newfilename;
            };
            _app.Update(step);
            return(result);
        }