Example #1
0
        public void ApplyDtlSave_FlowOrder(ApplyDtl applyDtl)
        {
            SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ApplyId", applyDtl.ApplyId.ToString()),
                                                       new SqlParameter("@ApplyTypeId", applyDtl.ApplyTypeId),
                                                       new SqlParameter("@ApplyContentId", applyDtl.ApplyContentId.ToString()),
                                                       new SqlParameter("@UserId", applyDtl.InUserId) };

            db.Database.ExecuteSqlCommand("EXEC up_Apply_ApplyDtl_FlowOrder_S @ApplyId,@ApplyTypeId,@ApplyContentId,@UserId", para);
        }
Example #2
0
        public void ApplyDtlDelete(ApplyDtl applyDtl)
        {
            if (applyDtl.ApplyTypeId == null)
            {
                applyDtl.ApplyTypeId = "";
            }
            SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ApplyId", applyDtl.ApplyId.ToString()),
                                                       new SqlParameter("@ApplyTypeId", applyDtl.ApplyTypeId.ToString()) };

            db.Database.ExecuteSqlCommand("EXEC up_Apply_ApplyDtl_D @ApplyId,@ApplyTypeId", para);
        }
Example #3
0
        public ActionResult ApplyCommit(string recheckUserId, Apply apply, int FlowOrderId, string applyIdexists, string seqNO, string attachArray)
        {
            ApplyService applayService = new ApplyService();

            apply.InDateTime  = DateTime.Now;
            apply.ApplyUserId = UserInfo.UserId;
            apply.ApplyTypeId = ApplyType.流转单.ToString();
            apply.ProjectId   = apply.ProjectId.HasValue ? apply.ProjectId.Value : 0;
            int applyId = 0;

            if (Convert.ToInt32(applyIdexists) == 0)
            {
                applyId = applayService.ApplyCommit(apply, recheckUserId);
            }
            else
            {
                ApplyRecheckStatus status = new ApplyRecheckStatus();
                status.ApplyId           = Convert.ToInt32(applyIdexists);
                status.RecheckUserId     = ((Mst_UserInfo)Session["LoginUser"]).UserId;
                status.RecheckStatusCode = "申请";
                status.RecheckReason     = apply.ApplyReason == null ? "" : apply.ApplyReason;
                status.SeqNO             = Convert.ToInt32(seqNO);
                status.InDateTime        = DateTime.Now;
                applayService.ApplyRecheckStatusUpdate(status, recheckUserId);
                applyId = Convert.ToInt32(applyIdexists);
            }
            applayService.ApplyDtlDelete(new ApplyDtl {
                ApplyId = applyId, ApplyTypeId = "流转单"
            });
            ApplyDtl applyDtl = new ApplyDtl()
            {
                ApplyId        = applyId,
                ApplyContentId = FlowOrderId,
                ApplyTypeId    = ApplyType.流转单.ToString(),
                InDateTime     = DateTime.Now,
                InUserId       = UserInfo.UserId
            };

            //applayService.ApplyDtlSave(applyDtl);
            applayService.ApplyDtlSave_FlowOrder(applyDtl);
            MyApplyDto applyInfo = applayService.ApplySearchById(applyId.ToString()).FirstOrDefault();

            ApplyEmailSend(applyInfo, recheckUserId);

            //保存附件
            List <string> attachList = JsonConvert.DeserializeObject <List <string> >(attachArray);
            int           fileSeqNO  = 1;

            attachList.ForEach((string attach) =>
            {
                db.ApplyFile.Add(new ApplyFile()
                {
                    ApplyId    = applyId,
                    FileName   = attach,
                    InDateTime = DateTime.Now,
                    InUserId   = UserInfo.UserId,
                    SeqNO      = fileSeqNO++
                });
            });
            db.SaveChanges();

            return(Json(applyId, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public ActionResult ApplyCommit(string recheckUserId, Apply apply, string projectId, string groupId, string applyIdexists, string seqNO, string attachArray)
        {
            //apply.InDateTime = DateTime.Now;
            //apply.ApplyUserId = UserInfo.UserId;
            //apply.ApplyTypeId = ApplyType.确认单.ToString();
            //apply.ProjectId = Convert.ToInt32(projectId);
            //int applyId = applayService.ApplyCommit(apply, recheckUserId);
            ApplyService applayService = new ApplyService();

            apply.InDateTime  = DateTime.Now;
            apply.ApplyUserId = UserInfo.UserId;
            apply.ApplyTypeId = ApplyType.确认单.ToString();
            apply.ProjectId   = Convert.ToInt32(groupId);// 确认单申请时ProjectId 保存为groupId
            int applyId = 0;

            if (Convert.ToInt32(applyIdexists) == 0)
            {
                applyId = applayService.ApplyCommit(apply, recheckUserId);
            }
            else
            {
                applyId = Convert.ToInt32(applyIdexists);
                ApplyRecheckStatus status = new ApplyRecheckStatus();
                status.ApplyId           = Convert.ToInt32(applyIdexists);
                status.RecheckUserId     = ((Mst_UserInfo)Session["LoginUser"]).UserId;
                status.RecheckStatusCode = "申请";
                status.RecheckReason     = apply.ApplyReason == null ? "" : apply.ApplyReason;
                status.SeqNO             = Convert.ToInt32(seqNO);
                status.InDateTime        = DateTime.Now;
                applayService.ApplyRecheckStatusUpdate(status, recheckUserId);
            }
            applayService.ApplyDtlDelete(new ApplyDtl {
                ApplyId = applyId
            });
            List <QuotationMstDto> list = quotationService.QuotationMstSearchByGroupId(projectId, groupId);

            foreach (QuotationMstDto item in list)
            {
                ApplyDtl applyDtl = new ApplyDtl()
                {
                    ApplyId        = applyId,
                    ApplyContentId = Convert.ToInt32(item.QuotationId),
                    ApplyTypeId    = ApplyType.确认单.ToString(),
                    InDateTime     = DateTime.Now,
                    InUserId       = UserInfo.UserId
                };
                applayService.ApplyDtlSave(applyDtl);
            }
            MyApplyDto applyInfo = applayService.ApplySearchById(applyId.ToString()).FirstOrDefault();

            ApplyEmailSend(applyInfo, recheckUserId);

            //保存附件
            List <string> attachList = JsonConvert.DeserializeObject <List <string> >(attachArray);
            int           fileSeqNO  = 1;

            attachList.ForEach((string attach) =>
            {
                db.ApplyFile.Add(new ApplyFile()
                {
                    ApplyId    = applyId,
                    FileName   = attach,
                    InDateTime = DateTime.Now,
                    InUserId   = UserInfo.UserId,
                    SeqNO      = fileSeqNO++
                });
            });
            db.SaveChanges();

            return(Json(applyId, JsonRequestBehavior.AllowGet));
        }