Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                int attachId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out attachId) || attachId <= 0)
                {
                    Response.Write("下载文件序号出错");
                    Response.End();
                }

                NFMT.Operate.BLL.AttachBLL bll = new NFMT.Operate.BLL.AttachBLL();
                NFMT.Common.ResultModel result = bll.Get(user, attachId);
                if (result.ResultStatus != 0)
                {
                    Response.Write(result.Message);
                    Response.End();
                }

                NFMT.Operate.Model.Attach attach = result.ReturnValue as NFMT.Operate.Model.Attach;
                if (attach == null)
                {
                    Response.Write("获取附件出错");
                    Response.End();
                }

                DownLoadFile(attach.AttachName, attach.ServerAttachName);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            int attachId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["aid"]) || !int.TryParse(context.Request.Form["aid"], out attachId) || attachId <= 0)
            {
                context.Response.Write("附件序号错误");
                context.Response.End();
            }

            int status = 0;
            if (string.IsNullOrEmpty(context.Request.Form["s"]) || !int.TryParse(context.Request.Form["s"], out status) || status <= 0)
            {
                context.Response.Write("状态信息错误");
                context.Response.End();
            }

            try
            {
                NFMT.Operate.BLL.AttachBLL bll = new NFMT.Operate.BLL.AttachBLL();
                result = bll.UpdateAttachStatus(user, attachId, status);
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(result.Message);
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            int contractId = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["cid"]))
            {
                if (!int.TryParse(context.Request.QueryString["cid"], out contractId))
                    contractId = 0;
            }

            int status = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["s"]))
            {
                if (!int.TryParse(context.Request.QueryString["s"], out status))
                    status = 0;
            }

            int type = 0;
            if (string.IsNullOrEmpty(context.Request.QueryString["t"]) || !int.TryParse(context.Request.QueryString["t"], out type) || type <= 0)
            {
                type = 0;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.Operate.BLL.AttachBLL bll = new NFMT.Operate.BLL.AttachBLL();
            NFMT.Common.SelectModel select = bll.GetAttachSelectModel(pageIndex, pageSize, orderStr, contractId, status, type);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            //if (result.ResultStatus != 0)
            //{
            //    context.Response.Write(result.Message);
            //    context.Response.End();
            //}

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            System.Collections.Generic.Dictionary<string, object> dic = new System.Collections.Generic.Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

            context.Response.Write(postData);
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Utility.VerificationUtility ver = new Utility.VerificationUtility();
                //ver.JudgeOperate(this.Page, 85, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 });

                NFMT.Common.UserModel user = NFMTSite.Utility.UserUtility.CurrentUser;
                string directURL = string.Format("{0}WorkFlow/AuditedList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

                this.navigation1.Routes.Add("已审核任务列表", directURL);
                this.navigation1.Routes.Add("已审核任务明细", string.Empty);

                int taskId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(directURL);
                if (!int.TryParse(Request.QueryString["id"], out taskId))
                    Response.Redirect(directURL);

                this.hidtaskId.Value = taskId.ToString();

                NFMT.WorkFlow.BLL.TaskBLL taskBLL = new NFMT.WorkFlow.BLL.TaskBLL();
                NFMT.Common.ResultModel result = taskBLL.Get(user, taskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.Task task = result.ReturnValue as NFMT.WorkFlow.Model.Task;

                //获取任务附件
                NFMT.WorkFlow.BLL.TaskAttachBLL taskAttachBLL = new NFMT.WorkFlow.BLL.TaskAttachBLL();
                result = taskAttachBLL.GetTaskAttachByTaskId(user, task.TaskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                List<NFMT.WorkFlow.Model.TaskAttach> taskAttachs = result.ReturnValue as List<NFMT.WorkFlow.Model.TaskAttach>;
                if (taskAttachs == null && !taskAttachs.Any())
                    Response.Redirect(directURL);

                string aids = string.Empty;
                foreach (NFMT.WorkFlow.Model.TaskAttach taskAttach in taskAttachs)
                {
                    aids += taskAttach.AttachId + ",";
                }
                if (!string.IsNullOrEmpty(aids))
                    aids = aids.Substring(0, aids.Length - 1);

                //获取任务附件
                NFMT.Operate.BLL.AttachBLL attachBLL = new NFMT.Operate.BLL.AttachBLL();
                result = attachBLL.GetAttachByAttachIds(user, aids);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                attachs = result.ReturnValue as List<NFMT.Operate.Model.Attach>;
                if (attachs != null && attachs.Any())
                    hasAttachs = true;

                NFMT.WorkFlow.BLL.DataSourceBLL dataSourceBLL = new NFMT.WorkFlow.BLL.DataSourceBLL();
                result = dataSourceBLL.Get(user,task.DataSourceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.DataSource dataSource = result.ReturnValue as NFMT.WorkFlow.Model.DataSource;

                if (task != null)
                {
                    this.spTaskName.InnerText = task.TaskName;
                    NFMT.User.Model.Employee emp = NFMT.User.UserProvider.Employees.SingleOrDefault(a => a.EmpId == dataSource.EmpId);
                    if (emp != null)
                        this.spTaskApplyPerson.InnerText = emp.Name;
                    this.spTaskApplyTime.InnerText = dataSource.ApplyTime.ToString();
                    this.spTaskStatus.InnerText = task.TaskStatusName;
                    this.spTaskMemo.InnerText = task.ApplyMemo;

                    this.viewUrl = string.IsNullOrEmpty(dataSource.ViewUrl.Trim()) ? "#" : string.Format("{0}{1}", NFMT.Common.DefaultValue.NfmtSiteName, string.Format(dataSource.ViewUrl, dataSource.RowId));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Utility.VerificationUtility ver = new Utility.VerificationUtility();
                //ver.JudgeOperate(this.Page, 22, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 });

                NFMT.Common.UserModel user = NFMTSite.Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                string directURL = string.Format("{0}WorkFlow/TaskList.aspx", NFMT.Common.DefaultValue.NfmtSiteName);

                this.navigation1.Routes.Add("待审核任务列表", directURL);
                this.navigation1.Routes.Add("待审核任务明细", string.Empty);

                int nodeId = 0;//taskNodeId
                if (nodeId == 0 && (string.IsNullOrEmpty(Request.QueryString["NodeId"]) || !int.TryParse(Request.QueryString["NodeId"], out nodeId)))
                    Response.Redirect(directURL);

                this.hidId.Value = nodeId.ToString();

                //获取任务节点
                NFMT.WorkFlow.BLL.TaskNodeBLL taskNodeBLL = new NFMT.WorkFlow.BLL.TaskNodeBLL();
                result = taskNodeBLL.Get(user, nodeId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.TaskNode taskNode = result.ReturnValue as NFMT.WorkFlow.Model.TaskNode;
                if (taskNode == null || taskNode.TaskNodeId <= 0)
                    Response.Redirect(directURL);

                if (taskNode.NodeStatus != NFMT.Common.StatusEnum.待审核 || taskNode.EmpId != user.EmpId)
                    Response.Redirect(directURL);

                //获取节点
                NFMT.WorkFlow.BLL.NodeBLL nodeBLL = new NFMT.WorkFlow.BLL.NodeBLL();
                result = nodeBLL.Get(user, taskNode.NodeId);
                if (result.ResultStatus == 0)
                {
                    NFMT.WorkFlow.Model.Node node = result.ReturnValue as NFMT.WorkFlow.Model.Node;
                    if (node == null || node.NodeId <= 0)
                        Response.Redirect(directURL);

                    nodeType = node.NodeType;
                }

                //获取任务
                NFMT.WorkFlow.BLL.TaskBLL taskBLL = new NFMT.WorkFlow.BLL.TaskBLL();
                result = taskBLL.Get(user, taskNode.TaskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.Task task = result.ReturnValue as NFMT.WorkFlow.Model.Task;
                if (task == null || task.TaskId <= 0 || task.TaskStatus != NFMT.Common.StatusEnum.已生效)
                    Response.Redirect(directURL);

                //获取任务附件
                NFMT.WorkFlow.BLL.TaskAttachBLL taskAttachBLL = new NFMT.WorkFlow.BLL.TaskAttachBLL();
                result = taskAttachBLL.GetTaskAttachByTaskId(user, task.TaskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                List<NFMT.WorkFlow.Model.TaskAttach> taskAttachs = result.ReturnValue as List<NFMT.WorkFlow.Model.TaskAttach>;
                if (taskAttachs == null && !taskAttachs.Any())
                    Response.Redirect(directURL);

                string aids = string.Empty;
                foreach (NFMT.WorkFlow.Model.TaskAttach taskAttach in taskAttachs)
                {
                    aids += taskAttach.AttachId + ",";
                }
                if (!string.IsNullOrEmpty(aids))
                    aids = aids.Substring(0, aids.Length - 1);

                //获取任务附件
                NFMT.Operate.BLL.AttachBLL attachBLL = new NFMT.Operate.BLL.AttachBLL();
                result = attachBLL.GetAttachByAttachIds(user, aids);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                attachs = result.ReturnValue as List<NFMT.Operate.Model.Attach>;
                if (attachs != null && attachs.Any())
                    hasAttachs = true;

                this.hidtaskId.Value = task.TaskId.ToString();

                //if (task.TaskStatus != NFMT.Common.StatusEnum.已生效)
                //    Response.Redirect(directURL);

                //获取数据源
                NFMT.WorkFlow.BLL.DataSourceBLL dataSourceBLL = new NFMT.WorkFlow.BLL.DataSourceBLL();
                result = dataSourceBLL.Get(user, task.DataSourceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                dataSource = result.ReturnValue as NFMT.WorkFlow.Model.DataSource;
                if (dataSource == null || dataSource.SourceId <= 0)
                    Response.Redirect(directURL);

                //判断该任务节点是否需要操作,如有,则跳转到相应界面
                NFMT.WorkFlow.BLL.TaskOperateBLL taskOperateBLL = new NFMT.WorkFlow.BLL.TaskOperateBLL();
                result = taskOperateBLL.GetByTaskNodeId(user, taskNode.TaskNodeId);
                if (result.ResultStatus == 0)
                {
                    NFMT.WorkFlow.Model.TaskOperate taskOperate = result.ReturnValue as NFMT.WorkFlow.Model.TaskOperate;
                    try
                    {
                        Response.Redirect(string.Format(taskOperate.OperateUrl, dataSource.RowId.ToString(), taskNode.TaskNodeId));
                    }
                    catch (Exception ex)
                    {
                        this.WarmAlert(ex.Message, "#");
                    }
                }

                this.spTaskName.InnerText = task.TaskName;
                NFMT.User.Model.Employee emp = NFMT.User.UserProvider.Employees.FirstOrDefault(temp => temp.EmpId == dataSource.EmpId);
                if (emp != null)
                    this.spTaskApplyPerson.InnerText = emp.Name;
                this.spTaskApplyTime.InnerText = dataSource.ApplyTime.ToString();
                this.spTaskMemo.InnerText = task.TaskConnext;
                //this.spTaskStatus.InnerText = task.TaskStatusName;
                //this.spTaskFlowDesc.InnerText = task.FlowDescribtion;

                this.viewUrl = string.IsNullOrEmpty(dataSource.ViewUrl.Trim()) ? "#" : string.Format("{0}{1}", NFMT.Common.DefaultValue.NfmtSiteName, string.Format(dataSource.ViewUrl, dataSource.RowId));

                NFMT.Operate.AttachType attachType = attachBLL.GetAttachTypeByModel(new NFMT.Common.AuditModel() { TableName = dataSource.TableCode });
                attachTypeId = (int)attachType;
            }
        }
Example #6
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            try
            {
                int id = 0;
                if (string.IsNullOrEmpty(context.Request.QueryString["id"]) || !int.TryParse(context.Request.QueryString["id"], out id) || id <= 0)
                {
                    context.Response.Write("序号错误");
                    context.Response.End();
                }

                int type = 0;
                if (string.IsNullOrEmpty(context.Request.QueryString["t"]) || !int.TryParse(context.Request.QueryString["t"], out type) || type <= 0)
                {
                    context.Response.Write("类型错误");
                    context.Response.End();
                }

                NFMT.Common.IAttachModel obj = null;
                NFMT.Common.IOperate operate = null;
                string dir = string.Empty;

                switch (type)
                {
                    case (int)NFMT.Operate.AttachType.CashInAttach:
                        obj = new NFMT.Funds.Model.ReceivableAttach();
                        operate = new NFMT.Funds.DAL.ReceivableAttachDAL();
                        dir = "CashIn";
                        break;
                    case (int)NFMT.Operate.AttachType.ContractAttach:
                        obj = new NFMT.Contract.Model.ContractAttach();
                        operate = new NFMT.Contract.DAL.ContractAttachDAL();
                        dir = "Contract";
                        break;
                    case (int)NFMT.Operate.AttachType.InvoiceAttach:
                        obj = new NFMT.Invoice.Model.InvoiceAttach();
                        operate = new NFMT.Invoice.DAL.InvoiceAttachDAL();
                        dir = "Invoice";
                        break;
                    case (int)NFMT.Operate.AttachType.PaymentAttach:
                        obj = new NFMT.Funds.Model.PaymentAttach();
                        operate = new NFMT.Funds.DAL.PaymentAttachDAL();
                        dir = "Payment";
                        break;
                    case (int)NFMT.Operate.AttachType.StockAttach:
                        obj = new NFMT.WareHouse.Model.StocktAttach();
                        operate = new NFMT.WareHouse.DAL.StocktAttachDAL();
                        dir = "Stock";
                        break;
                    case (int)NFMT.Operate.AttachType.StockInAttach:
                    case (int)NFMT.Operate.AttachType.BillAttach:
                        obj = new NFMT.WareHouse.Model.StockInAttach((NFMT.Operate.AttachType)type);
                        operate = new NFMT.WareHouse.DAL.StockInAttachDAL();
                        dir = "StockIn";
                        break;
                    case (int)NFMT.Operate.AttachType.StockLogAttach:
                        obj = new NFMT.WareHouse.Model.StockLogAttach();
                        operate = new NFMT.WareHouse.DAL.StockInAttachDAL();
                        dir = "StockLog";
                        break;
                    case (int)NFMT.Operate.AttachType.StockOutAttach:
                        obj = new NFMT.WareHouse.Model.StockOutAttach();
                        operate = new NFMT.WareHouse.DAL.StockOutAttachDAL();
                        dir = "StockOut";
                        break;
                    case (int)NFMT.Operate.AttachType.SplitDocAttach:
                        obj = new NFMT.WareHouse.Model.SplitDocAttach();
                        operate = new NFMT.WareHouse.DAL.SplitDocAttachDAL();
                        dir = "SplitDoc";
                        break;
                    case (int)NFMT.Operate.AttachType.CustomApplyAttach:
                        obj = new NFMT.WareHouse.Model.CustomsApplyAttach();
                        operate = new NFMT.WareHouse.DAL.CustomsApplyAttachDAL();
                        dir = "CustomApply";
                        break;
                    case (int)NFMT.Operate.AttachType.CustomAttach:
                        obj = new NFMT.WareHouse.Model.CustomsAttach();
                        operate = new NFMT.WareHouse.DAL.CustomsAttachDAL();
                        dir = "Custom";
                        break;
                    case (int)NFMT.Operate.AttachType.SubAttach:
                        obj = new NFMT.Contract.Model.ContractSubAttach();
                        operate = new NFMT.Contract.DAL.ContractSubAttachDAL();
                        dir = "Sub";
                        break;
                    case (int)NFMT.Operate.AttachType.OrderAttach:
                        obj = new NFMT.Document.Model.DocumentOrderAttach();
                        operate = new NFMT.Document.DAL.DocumentOrderAttachDAL();
                        dir = "DocumentOrder";
                        break;
                    case (int)NFMT.Operate.AttachType.PledgeAttach:
                        obj = new NFMT.WareHouse.Model.PledgeAttach();
                        operate = new NFMT.WareHouse.DAL.PledgeAttachDAL();
                        dir = "Pledge";
                        break;
                    case (int)NFMT.Operate.AttachType.BusinessLiceneseAttach:
                    case (int)NFMT.Operate.AttachType.TaxAttach:
                    case (int)NFMT.Operate.AttachType.OrganizationAttach:
                    case (int)NFMT.Operate.AttachType.CertifyAttach:
                        obj = new NFMT.User.Model.CorpDetailAttach((NFMT.Operate.AttachType)type);
                        operate = new NFMT.User.DAL.CorpDetailAttachDAL();
                        dir = "CorpDetail";
                        break;
                    case (int)NFMT.Operate.AttachType.采购双签合同:
                    case (int)NFMT.Operate.AttachType.采购合同:
                    case (int)NFMT.Operate.AttachType.在库提单附件:
                    case (int)NFMT.Operate.AttachType.在途提单附件:
                    case (int)NFMT.Operate.AttachType.发票扫描件:
                    case (int)NFMT.Operate.AttachType.点价确认单:
                    case (int)NFMT.Operate.AttachType.合同结算单:
                    case (int)NFMT.Operate.AttachType.费用明细清单:
                        obj = new NFMT.Funds.Model.PayApplyAttach((NFMT.Operate.AttachType)type);
                        operate = new NFMT.Funds.DAL.PayApplyAttachDAL();
                        dir = "PayApply";
                        break;
                    default:
                        break;
                }

                string path = context.Server.MapPath("../");
                if (!string.IsNullOrEmpty(dir))
                    path = string.Format("{0}{1}", path, dir);

                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.DirectoryInfo dirInfo = System.IO.Directory.CreateDirectory(path);
                    dirInfo.Create();
                }

                HttpFileCollection files = context.Request.Files;
                List<NFMT.Operate.Model.Attach> attachs = new List<NFMT.Operate.Model.Attach>();

                if (files.Count > 0)
                {
                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFile postFile = files[i];
                        string newFileName = DateTime.Now.Ticks.ToString() + Guid.NewGuid().ToString() + new Random().Next().ToString() + System.IO.Path.GetExtension(postFile.FileName).ToLower();
                        //string fileName = string.Format("{0}{1}", path, newFileName);
                        string fileName = path + "\\" + newFileName;
                        postFile.SaveAs(fileName);

                        string attachPath = string.Format("../Files/{0}/{1}", dir, newFileName);

                        attachs.Add(new NFMT.Operate.Model.Attach()
                            {
                                AttachName = postFile.FileName,
                                ServerAttachName = fileName,
                                AttachExt = System.IO.Path.GetExtension(fileName).ToLower(),
                                AttachType = type,
                                AttachInfo = string.Empty,
                                AttachLength = postFile.ContentLength,
                                AttachPath = attachPath,
                                AttachStatus = NFMT.Common.StatusEnum.已生效
                            });
                    }

                    NFMT.Operate.BLL.AttachBLL bll = new NFMT.Operate.BLL.AttachBLL();
                    result = bll.AddAttach(user, attachs, id, obj, operate);
                }
                else
                {
                    result.ResultStatus = -1;
                    result.Message = "无附件上传";
                }
            }
            catch (Exception e)
            {
                result.ResultStatus = -1;
                result.Message = e.Message;
            }
            finally
            {
                if (result.ResultStatus != 0)
                    this.log.ErrorFormat("{0} {1},序号:{2}", user.EmpName, result.Message, result.ReturnValue);
                else if (this.log.IsInfoEnabled)
                    this.log.InfoFormat("{0} {1},序号:{2}", user.EmpName, result.Message, result.ReturnValue);
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            context.Response.End();
        }