Example #1
0
        public ActionResult Index(string id)
        {
            log.Info("Search For Estimation Form !!");
            ViewBag.projectid = id;
            getProject(id);
            //取得表單狀態參考資料
            SelectList LstStatus = new SelectList(SystemParameter.getSystemPara("ExpenseForm"), "KEY_FIELD", "VALUE_FIELD");

            ViewData.Add("status", LstStatus);
            string strStatus = null;

            if (null != Request["status"])
            {
                strStatus = Request["status"];
            }
            else
            {
                strStatus = "30";
            }
            EstimationFormApprove model = new EstimationFormApprove();
            //取得審核中表單資料
            Flow4Estimation   workflow = new Flow4Estimation();
            EstimationService es       = new EstimationService();

            model.lstEstimationFlowTask = workflow.getEstimationFormRequest(Request["contractid"], Request["payee"], Request["estid"], id, strStatus);
            ViewBag.SearchResult        = "共取得" + model.lstEstimationFlowTask + "筆資料";
            getProject(id);
            return(View(model));
        }
Example #2
0
        public HttpResponseMessage Save(EstimationModel model)
        {
            try
            {
                IEstimationService service = new EstimationService();
                var result = service.SaveEstimation(model);
                if (result)
                {
                    new EmailService().SendEstimationRequestEmailToAdmin(model);

                    return(Request.CreateResponse(HttpStatusCode.OK, result));
                }
                else
                {
                    string message = "Error Saving Data";
                    return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #3
0
        public void downLoadExpenseForm()
        {
            string formid = Request["formid"];

            log.Debug("download Excel:" + formid);
            EstimationService service   = new EstimationService();
            ContractModels    constract = service.getEstimationOrder(formid);

            if (null != constract)
            {
                PaymentExpenseFormToExcel poi = new PaymentExpenseFormToExcel();
                //檔案位置
                string fileLocation = poi.exportExcel(constract);
                //檔案名稱 HttpUtility.UrlEncode預設會以UTF8的編碼系統進行QP(Quoted-Printable)編碼,可以直接顯示的7 Bit字元(ASCII)就不用特別轉換。
                string filename = HttpUtility.UrlEncode(Path.GetFileName(fileLocation));
                Response.Clear();
                Response.Charset     = "utf-8";
                Response.ContentType = "text/xls";
                Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", filename));
                ///"\\" + form.PROJECT_ID + "\\" + ContextService.quotesFolder + "\\" + form.FORM_ID + ".xlsx"
                Response.WriteFile(fileLocation);
                Response.End();
            }
        }