예제 #1
0
        public IHttpActionResult DeleteVoucher(VoucherIdViewModel voucher)
        {
            string[] vids = voucher.VId.Split(',');
            try
            {
                foreach (string vid in vids)
                {
                    long delVid;
                    if (long.TryParse(vid, out delVid))
                    {
                        _voucher.Delete(delVid);
                    }
                    else
                    {
                        ResMessage.Fail(string.Format("无效凭证编号:{0}", vid));
                    }
                }
            }
            catch (Exception e)
            {
                ResMessage.Fail(e.Message);
            }

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteCertWord(CertWordDeleteViewModel certWord)
        {
            if (certWord == null)
            {
                ResMessage.Fail("传入模型为空");
            }

            _certWord.Delete(certWord.CwId);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteWorkOrder(WorkOrderDelViewModel workOrder)
        {
            if (workOrder.WoId <= 0)
            {
                ResMessage.Fail("要删除的工单编号无效");
            }

            _progress.DeleteWorkOrder(workOrder);

            return(Ok(ResMessage.Success()));
        }
예제 #4
0
        public IHttpActionResult DeleteCustomer(BizCustomerDelViewModel cusDel)
        {
            if (cusDel.CusId <= 0)
            {
                ResMessage.Fail("无效客户编号");
            }

            _customer.DeleteCustomer(cusDel.CusId);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteAccount(AccountDeleteViewModel vmAccount)
        {
            if (vmAccount == null)
            {
                ResMessage.Fail("参数为空");
            }

            _account.DeleteAccount(vmAccount.AccId);

            return(Ok(ResMessage.Success()));
        }
예제 #6
0
 public IHttpActionResult SaveBizItem(BizItemViewModel item)
 {
     try
     {
         _setting.SaveBizItem(item);
     }
     catch (Exception err)
     {
         ResMessage.Fail(err.Message);
     }
     return(Ok(ResMessage.Success()));
 }
예제 #7
0
 public IHttpActionResult SaveBizCategory(BizCategoryViewModel category)
 {
     try
     {
         _setting.SaveCategory(category);
     }
     catch (Exception err)
     {
         ResMessage.Fail(err.Message);
     }
     return(Ok(ResMessage.Success()));
 }
예제 #8
0
        public IHttpActionResult DeleteBizStep(BizConfigDeleteViewModel step)
        {
            try
            {
                _setting.DeleteBizStep(step.id);
            }
            catch (Exception err)
            {
                ResMessage.Fail(err.Message);
            }

            return(Ok(ResMessage.Success()));
        }
예제 #9
0
        public IHttpActionResult SaveBizStep(BizStepsViewModel step)
        {
            try
            {
                _setting.SaveBizStep(step);
            }
            catch (Exception err)
            {
                ResMessage.Fail(err.Message);
            }

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult SaveAccountBook(AcctBookViewModels acctBook)
        {
            string err;

            if (!_modelValid.ValidAccountBookCreate(acctBook, out err))
            {
                ResMessage.Fail(err);
            }

            _acctBook.Save(acctBook);

            return(Ok(ResMessage.Success()));
        }
예제 #11
0
        public IHttpActionResult DeleteBizCategory(BizConfigDeleteViewModel category)
        {
            try
            {
                _setting.DeleteCategory(category.id);
            }
            catch (Exception err)
            {
                ResMessage.Fail(err.Message);
            }

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult SaveWorkOrder(WorkOrderViewModel progress)
        {
            string err;

            if (!_modelValid.ValidBizProgress(progress, out err))
            {
                ResMessage.Fail(err);
            }

            _progress.SaveWorkOrder(progress);

            return(Ok(ResMessage.Success()));
        }
예제 #13
0
        public IHttpActionResult SetInvoicePath(VoucherInvoicePathModel invoice)
        {
            try
            {
                _voucher.SetInvoicePath(invoice.VId, invoice.InvoicePath);
            }
            catch (Exception e)
            {
                ResMessage.Fail(e.Message);
            }

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteWorkProgress(WorkProgressDelViewModel delWorkProg)
        {
            if (delWorkProg.ProgId <= 0)
            {
                ResMessage.Fail("待删除的进度编号无效");
            }

            try
            {
                _progress.DeleteWorkProgress(delWorkProg.ProgId);
            }
            catch (Exception err)
            {
                ResMessage.Fail(err.Message);
            }

            return(Ok(ResMessage.Success()));
        }
예제 #15
0
        public IHttpActionResult SaveVoucher(VoucherViewModel voucher)
        {
            string err;

            //校验借贷是否平衡、凭证字号是否最新、科目是否有效等
            if (!_modelValid.ValidVoucher(voucher, out err))
            {
                ResMessage.Fail(err);
            }

            Voucher v = _voucher.Save(voucher);

            ResMessageContent rmContent = ResMessage.Success();

            rmContent.State = Mapper.Map <VoucherViewModel>(v);

            return(Ok(rmContent));
        }
예제 #16
0
        public IHttpActionResult Unaudit(VoucherIdViewModel voucher)
        {
            string[] vids = voucher.VId.Split(',');
            try
            {
                foreach (string vid in vids)
                {
                    long audVid;
                    if (long.TryParse(vid, out audVid))
                    {
                        _voucher.Unaudit(audVid);
                    }
                }
            }
            catch (Exception e)
            {
                ResMessage.Fail(e.Message);
            }

            return(Ok(ResMessage.Success()));
        }
예제 #17
0
        public IHttpActionResult DeleteAbstract(AbstractViewModel abs)
        {
            _voucher.DeleteAbstract(abs.AbsId);

            return(Ok(ResMessage.Success()));
        }
예제 #18
0
        public IHttpActionResult SaveAbstract(AbstractViewModel abs)
        {
            _voucher.SaveAbstract(abs);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteAuxiliary(AuxiliaryDeleteViewModel delAux)
        {
            _auxType.DeleteAuxiliary(delAux.AuxId);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult ChangeStateWorkOrder(WorkOrderViewModel workOrder)
        {
            _progress.ChangeStateWorkOrder(workOrder);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult AddAuxiliaryType(AuxiliaryTypeViewModel auxType)
        {
            _auxType.Add(auxType.AuxType);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult SaveCertWord(CertWordViewModel certWord)
        {
            _certWord.Save(certWord);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteAccountBook(AcctBookDelViewModel acctBook)
        {
            _acctBook.Delete(acctBook.AbId);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult AddAuxAccount(AuxiliaryAccountViewModel vmAuxAccount)
        {
            _account.AddAuxAccount(vmAuxAccount);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult DeleteAuxiliaryType(AuxiliaryTypeViewModel auxType)
        {
            _auxType.Delete(auxType.AtId);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult SaveAccountInitial(AccountInitViewModel vmAccount)
        {
            _account.SaveAccountInitial(vmAccount.Accounts);

            return(Ok(ResMessage.Success()));
        }
예제 #27
0
        public IHttpActionResult SaveBizCustomer(BizCustomerViewModel customer)
        {
            _customer.SaveCustomer(customer);

            return(Ok(ResMessage.Success()));
        }
        public IHttpActionResult SetCertWordDefault(CertWordDeleteViewModel certWord)
        {
            _certWord.SetDefault(certWord.CwId);

            return(Ok(ResMessage.Success()));
        }
        public async Task <HttpResponseMessage> SaveWorkProgress()
        {
            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            string root     = HttpContext.Current.Server.MapPath(_uploadPath);
            var    provider = new MultipartFormDataStreamProvider(root);

            Dictionary <string, string> fileNames = new Dictionary <string, string>();

            try
            {
                // Read the form data.
                await Request.Content.ReadAsMultipartAsync(provider);

                // This illustrates how to get the file names.
                foreach (MultipartFileData file in provider.FileData)
                {
                    if (File.Exists(file.LocalFileName))
                    {
                        FileInfo fi = new FileInfo(file.LocalFileName);
                        if (fi.Length < 500)
                        {
                            File.Delete(file.LocalFileName);
                            continue;
                        }
                        else
                        {
                            File.Move(file.LocalFileName, string.Format("{0}{1}", file.LocalFileName, Path.GetExtension(file.Headers.ContentDisposition.FileName.Replace("\"", ""))));
                        }
                    }

                    fileNames.Add(file.Headers.ContentDisposition.FileName, file.LocalFileName);
                }

                WorkProgressViewModel wProg = new WorkProgressViewModel();
                long progid;
                if (long.TryParse(HttpContext.Current.Request.Form["ProgId"], out progid))
                {
                    wProg.ProgId = progid;
                }
                wProg.StepId    = Convert.ToInt32(HttpContext.Current.Request.Form["StepId"]);
                wProg.WoId      = Convert.ToInt64(HttpContext.Current.Request.Form["WorkOrderId"]);
                wProg.SortIndex = Convert.ToInt32(HttpContext.Current.Request.Form["SortIndex"]);
                DateTime dt;
                if (DateTime.TryParse(HttpContext.Current.Request.Form["CompletedTime"], out dt))
                {
                    wProg.CompletedTime = dt;
                }
                wProg.ResultDesc = HttpContext.Current.Request.Form["ResultDesc"];
                decimal ae;
                if (decimal.TryParse(HttpContext.Current.Request.Form["AdvanceExpenditure"], out ae))
                {
                    wProg.AdvanceExpenditure = ae;
                }
                bool isSuc;
                if (bool.TryParse(HttpContext.Current.Request.Form["IsSuccess"], out isSuc))
                {
                    wProg.IsSuccess = isSuc;
                }

                if (fileNames.Count > 0)
                {
                    wProg.FileName = string.Format("{0}{1}", Path.GetFileName(fileNames.Values.FirstOrDefault()), Path.GetExtension(fileNames.Keys.FirstOrDefault().Replace("\"", "")));
                    wProg.Url      = string.Format("{0}/{1}", _uploadPath, Path.GetFileName(wProg.FileName));
                }
                _progress.SaveWorkProgress(wProg);


                return(Request.CreateResponse <ResMessageContent>(HttpStatusCode.OK, ResMessage.Success()));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
        public IHttpActionResult SaveAuxiliary(AuxiliaryViewModel vmAux)
        {
            _auxType.SaveAuxiliary(vmAux);

            return(Ok(ResMessage.Success()));
        }