示例#1
0
        public ActionResult SavePart(FormNcrPart part, string abnormalImage, string abnormalAttribution)
        {
            if (!string.IsNullOrEmpty(abnormalImage) || !string.IsNullOrEmpty(abnormalAttribution))
            {
                var upNcrMain = new BaseServices <FormNcr>();
                //保存描述
                var ncrMain = upNcrMain.Single(c => c.FormNo == part.ParentFormNo);
                ncrMain.AbnormalImage       = abnormalImage;
                ncrMain.AbnormalAttribution = abnormalAttribution;
                upNcrMain.UpdateEntity(ncrMain);
            }


            //return Content("111");
            string empNo = ManageProvider.Provider.Current().UserId;
            Dictionary <string, object> dictionary = Request.Form.Cast <object>().ToDictionary <object, string, object>(para => para.ToString(), para => Request.Form[para.ToString()]);

            var formId    = int.Parse(dictionary["formid"].ToString());
            var employees = new Applying().GetSignListByFormId(dictionary, formId, empNo);
            var form      = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = empNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = 0,
                IsEmergents = true,
            };



            FormNcrPart partA = new FormNcrPart()
            {
                Mark = part.Mark, ReplyType = formId, ParentFormNo = part.ParentFormNo, Reviewer = empNo, ReviewTime = DateTime.Now
            };
            var result = new F <FormNcrPart>().SaveData(new List <FormNcrPart>()
            {
                partA
            }, form);


            //送签
            if (!result)
            {
                return(Link.ErrorBy(new Exception("数据更新失败,请检查填写是否完整"), this.GetType()));
            }
            new Applying().Send(form.FormNo, empNo);


            var daiqian = new BaseServices <FormSign>().LoadEntities(c => c.FormNo == form.FormNo).Last();
            var signed  = new Signing().Agree(daiqian.FormNo, daiqian.RowId, daiqian.SignEmpNo);

            Console.Write(signed);

            return(Content("success"));
        }
示例#2
0
        private Form CreateForm(Dictionary <string, object> dictionary, out List <BaseEmployee> employees)
        {
            int formId = int.Parse(dictionary["formid"].ToString());

            employees = new Applying().GetSignListByFormId(dictionary, formId, EmpNo);

            var form = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = EmpNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = (int)Form.StatusEnum.未送出,
                IsEmergents = dictionary.ContainsKey("isemergents")
                              //Explain = dictionary["Form.Explain"].ToString()
            };

            FormNo = form.FormNo;
            return(form);
        }