Пример #1
0
        public IHttpActionResult PutPurchaseOrderTable(int id, PurchaseOrderTable purchaseOrderTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != purchaseOrderTable.PurchaseOrderID)
            {
                return(BadRequest());
            }

            db.Entry(purchaseOrderTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PurchaseOrderTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Save(int ProjectId, string jsonArr)
        {
            List <SupplierEvaAnswer> SupplierEvaAnswers = JsonConvert.DeserializeObject <List <SupplierEvaAnswer> >(jsonArr);

            foreach (SupplierEvaAnswer answer in SupplierEvaAnswers)
            {
                if (!answer.SupplierScore.HasValue)
                {
                    continue;
                }

                if (answer.Id > 0)
                {
                    answer.ModifyDateTime = DateTime.Now;
                    answer.ModifyUserId   = UserInfo.UserId;
                    db.Entry <SupplierEvaAnswer>(answer).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    answer.ProjectId  = ProjectId;
                    answer.InDateTime = DateTime.Now;
                    answer.InUserId   = UserInfo.UserId;
                    db.SupplierEvaAnswer.Add(answer);
                }
            }
            db.SaveChanges();

            return(Json(""));
        }
 public ActionResult Create(Constract constract)
 {
     constract.InDateTime = DateTime.Now;
     constract.InUserId   = UserInfo.UserId;
     db.Constract.Add(constract);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #4
0
        public ActionResult SaveBiancheng(int QuotationId, int?SeqNo, string QuotationType, int ProjectId, int SupplierId)
        {
            if (QuotationId == 0)
            {//新增确认单
                QuotationId = SaveQuotationMst(QuotationType, ProjectId, SupplierId);
                //获取seqno
                int seqNo  = 1;
                var maxOne = db.Quotation_Biancheng_Dtl.Where(x => x.QuotationId == QuotationId)
                             .OrderByDescending(x => x.SeqNO).Select(x => x.SeqNO).FirstOrDefault();
                if (maxOne > 0)
                {
                    seqNo = maxOne + 1;
                }
                Quotation_Biancheng_Dtl dtl = new Quotation_Biancheng_Dtl();
                TryUpdateModel <Quotation_Biancheng_Dtl>(dtl);
                dtl.SeqNO       = seqNo;
                dtl.QuotationId = QuotationId;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                db.Quotation_Biancheng_Dtl.Add(dtl);
            }
            else
            {
                Quotation_Biancheng_Dtl dtl = new Quotation_Biancheng_Dtl();
                dtl = db.Quotation_Biancheng_Dtl.Find(QuotationId, SeqNo);
                TryUpdateModel <Quotation_Biancheng_Dtl>(dtl);
            }

            db.SaveChanges();
            return(Json(new { QuotationId = QuotationId }));
        }
Пример #5
0
        public ActionResult Create(ConstractTemplate constractTemplate, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                constractTemplate.InDateTime = DateTime.Now;
                constractTemplate.InUserId   = UserInfo.UserId;
                db.ConstractTemplate.Add(constractTemplate);
                db.SaveChanges();
                return(RedirectToAction("Edit/" + constractTemplate.Id));
            }

            return(View(constractTemplate));
        }
        public ActionResult Save(string type, string code)
        {
            HiddenCode findOne = db.HiddenCode.Find(type, code);

            if (findOne == null)
            {//add
                findOne      = new HiddenCode();
                findOne.Name = code;
                TryUpdateModel <HiddenCode>(findOne);
                if (code == "不涉及" || code == "不限制")
                {
                    findOne.InDateTime = DateTime.MaxValue;
                }
                else
                {
                    findOne.InDateTime = DateTime.Now;
                }
                findOne.InUserId = UserInfo.UserId;
                db.HiddenCode.Add(findOne);
            }
            else
            {
                findOne.Name = code;
                TryUpdateModel <HiddenCode>(findOne);
            }
            db.SaveChanges();

            return(Json(findOne));
        }
Пример #7
0
        public void TestSaveSupplierMng()
        {
            AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory);

            using (var db = new PurchaseEntities())
            {
                SupplierMng supplier = db.SupplierMng.Find(0);
                // supplier.SupplierName = "供应商名称2";
                supplier.SupplierMngAttachmentFile.Clear();
                for (int i = 0; i < 2; i++)
                {
                    SupplierMngAttachmentFile attach = new SupplierMngAttachmentFile();
                    attach.FileName    = "fileName1";
                    attach.SeqNO       = i + 1;
                    attach.SupplierId  = supplier.Id;
                    attach.SupplierMng = supplier;
                    attach.UploadChk   = true;
                    attach.InDateTime  = DateTime.Now;
                    attach.InUserId    = "admin";

                    supplier.SupplierMngAttachmentFile.Add(attach);
                }
                db.SaveChanges();
            }
        }
Пример #8
0
        public ActionResult SaveRecheckProcess(RecheckProcess recheckProcess)
        {
            if (recheckProcess.SeqNO == 0)
            {
                int maxSeq = db.RecheckProcess.Where(x => x.RecheckType == recheckProcess.RecheckType).OrderByDescending(x => x.SeqNO).Select(x => x.SeqNO).FirstOrDefault();
                recheckProcess.SeqNO      = maxSeq + 1;
                recheckProcess.InDateTime = DateTime.Now;
                recheckProcess.InUserId   = UserInfo.UserId;
                db.RecheckProcess.Add(recheckProcess);
            }
            else
            {
                recheckProcess = db.RecheckProcess.Find(recheckProcess.RecheckType, recheckProcess.SeqNO);
                TryUpdateModel <RecheckProcess>(recheckProcess);
            }
            db.SaveChanges();

            return(Json(""));
        }
Пример #9
0
 public IHttpActionResult PostItemMaster(ItemMaster itemMaster)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     using (db)
     {
         if (itemMaster.Id == 0)
         {
             db.ItemMasters.Add(itemMaster);
             db.SaveChanges();
         }
         else
         {
             return(NotFound());
         }
     }
     return(Ok());
 }
        public ActionResult Delete(int AnswerId)
        {
            SupplierEvaAnswer supplierAnswer = db.SupplierEvaAnswer.Find(AnswerId);

            if (supplierAnswer != null)
            {
                db.SupplierEvaAnswer.Remove(supplierAnswer);
                db.SaveChanges();
            }

            return(Json(""));
        }
Пример #11
0
        public ActionResult Create(Projects projects)
        {
            if (ModelState.IsValid)
            {
                projects.InDateTime = DateTime.Now;
                projects.InUserId   = UserInfo.UserId;
                if (string.IsNullOrEmpty(projects.Status))
                {
                    projects.StatusDate = DateTime.Now;
                }
                db.Projects.Add(projects);
                db.SaveChanges();

                try
                {
                    // 保存提醒的信息
                    MasterService mster = new MasterService();
                    mster.RemindCancelSave("项目结束提醒", projects.Id.ToString(), projects.InUserId, projects.EndDate.ToString());
                }
                catch (Exception)
                {
                }


                return(RedirectToAction("Index", new { ModelType = modelTypes.IndexOf(projects.ModelType) }));
            }

            return(View(projects));
        }
        public ActionResult ChangePassword(string sNewPassword)
        {
            using (PurchaseEntities db = new PurchaseEntities())
            {
                Mst_UserInfo userInfo = db.Mst_UserInfo.Find(UserInfo.UserId);
                userInfo.Password = Utils.StrToMD5(sNewPassword);
                db.SaveChanges();
            }
            Session["LoginUser"] = null;
            FormsAuthentication.SignOut();

            return(Json(new { nAction = 2, sRedirectURL = "/Account/Login" }));
        }
Пример #13
0
        public void TestMethod1()
        {
            AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory);;

            using (var db = new PurchaseEntities())
            {
                db.Projects.Add(new Projects
                {
                    Id             = 5,
                    InUserId       = "1",
                    DepartmentCode = "DP",
                    StartDate      = DateTime.Now,
                    EndDate        = DateTime.Now,
                    ExcuteType     = "adsf",
                    InDateTime     = DateTime.Now,
                });
                db.SaveChanges();
            }
        }
Пример #14
0
        public IHttpActionResult PostSalesOrderHeader(SalesOrderHeader salesOrderHeader)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            using (db)
            {
                if (salesOrderHeader.Id == 0)
                {
                    db.SalesOrderHeaders.Add(salesOrderHeader);
                    db.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }
            return(Ok());
        }
        public void SaveContingency(string ProjectId, string ContingencyFee)
        {
            decimal?feeNullable = string.IsNullOrEmpty(ContingencyFee) ? new Nullable <decimal>() : new Decimal(Double.Parse(ContingencyFee));

            Contingency findOne = db.Contingency.Find(ProjectId);

            if (findOne != null)
            {
                findOne.ContingencyFee = feeNullable;
            }
            else
            {
                findOne = new Contingency()
                {
                    ProjectId      = ProjectId,
                    ContingencyFee = feeNullable,
                    InDateTime     = DateTime.Now,
                    InUserId       = UserInfo.UserId
                };
                db.Contingency.Add(findOne);
            }
            db.SaveChanges();
        }
        public ActionResult Save(Requirement_Group group)
        {
            string[] groupNameList = group.RequirementGroupName.Split('-');
            if (group.Id == 0)
            {
                group.RequirementGroupName = group.RequirementGroupName + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");
                group.IndateTime           = DateTime.Now;
                group.InUserId             = UserInfo.UserId;
                db.Requirement_Group.Add(group);
            }
            else
            {
                group = db.Requirement_Group.Find(group.Id);
                TryUpdateModel <Requirement_Group>(group);
                if (groupNameList.Length == 1)
                {
                    group.RequirementGroupName = group.RequirementGroupName + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");
                }
            }
            db.SaveChanges();

            return(Json(group));
        }
        public ActionResult Save(string userid, string Email, string EmailPassword)
        {
            Mst_UserInfo findOne = db.Mst_UserInfo.Find(userid);

            if (findOne == null)
            {
                findOne = new Mst_UserInfo();
                TryUpdateModel <Mst_UserInfo>(findOne);
                findOne.InDateTime = DateTime.Now;
                findOne.InUserId   = UserInfo.UserId;
                findOne.Password   = Utils.StrToMD5("12345");;
                db.Mst_UserInfo.Add(findOne);
                EmailSend(Email, "采购管理平台账号添加提醒", "采购管理平台自动提醒您:您的账号已经添加完毕,您的账号为:您的账号为:" + userid + "密码为12345.请及时修改密码");
            }
            else
            {
                TryUpdateModel <Mst_UserInfo>(findOne);
                EmailSend(Email, "采购平台账号信息变更提醒", "邮箱已经变更完毕,请及时确认");
            }
            SelectListTool.UserInfoList = null;
            db.SaveChanges();

            return(Json(""));
        }
        public ActionResult Create(SupplierMng supplierMng)
        {
            try
            {
                //if (ModelState.IsValid)
                //{

                List <SupplierDto> list = service.SupplierSearchBySupplierName(supplierMng.SupplierName, supplierMng.ServiceTrade);
                if (list.Count == 0)
                {
                    supplierMng.SupplierCode = GetSupplierCode(supplierMng.City);
                    db.SupplierMng.Add(supplierMng);
                    supplierMng.InDateTime     = DateTime.Now;
                    supplierMng.InUserId       = UserInfo.UserId;
                    supplierMng.UseChk         = true;
                    supplierMng.ModifyUserId   = UserInfo.UserId;
                    supplierMng.ModifyDateTime = DateTime.Now;

                    db.SaveChanges();
                    service.SupplierModifySave(supplierMng.Id.ToString(), UserInfo.UserId, "", true); // 新增的时候对财务人员保存一条提醒记录
                    SavePng(supplierMng);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                //}
                //else
                //{

                //}
                return(View(supplierMng));
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
        }
Пример #19
0
        public ActionResult ApplyCommit(string recheckUserId, Apply apply, string projectId, string groupId, string applyIdexists, string seqNO, string attachArray)
        {
            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, ApplyTypeId = "结算单"
            });
            List <SettlementGroupDtlDto> list = service.SettlementMstSearchByGroupId(projectId, groupId.ToString()).Where(x => x.SelectedChk == true).ToList();

            foreach (SettlementGroupDtlDto item in list)
            {
                ApplyDtl applyDtl = new ApplyDtl()
                {
                    ApplyId        = applyId,
                    ApplyContentId = Convert.ToInt32(item.SettlementId),
                    ApplyTypeId    = ApplyType.结算单.ToString(),
                    InDateTime     = DateTime.Now,
                    InUserId       = UserInfo.UserId
                };
                // applayService.ApplyDtlSave(applyDtl);
                applyService.ApplyDtlSave_Settlement(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));
        }
Пример #20
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));
        }
Пример #21
0
        public ActionResult SaveBiancheng(string jsonArr, string ProjectId, string SupplierId, string GroupId)
        {
            List <Quotation_Biancheng_Dtl> lst = JsonConvert.DeserializeObject <List <Quotation_Biancheng_Dtl> >(jsonArr);

            int QuotationId = SaveQuotationMst(GroupId, ProjectId, SupplierId, "Biancheng");

            foreach (Quotation_Biancheng_Dtl dtl in lst)
            {
                if (dtl.QuotationId == 0 && dtl.SeqNO == 0)
                {
                    int seqNo  = 1;
                    var maxOne = db.Quotation_Biancheng_Dtl.Where(x => x.QuotationId == QuotationId)
                                 .OrderByDescending(x => x.SeqNO).Select(x => x.SeqNO).FirstOrDefault();
                    if (maxOne > 0)
                    {
                        seqNo = maxOne + 1;
                    }

                    dtl.QuotationId = QuotationId;
                    dtl.SeqNO       = seqNo;
                    dtl.InDateTime  = DateTime.Now;
                    dtl.InUserId    = UserInfo.UserId;
                    db.Quotation_Biancheng_Dtl.Add(dtl);

                    db.SaveChanges();
                }
                else
                {
                    Quotation_Biancheng_Dtl findOne = db.Quotation_Biancheng_Dtl.Find(dtl.QuotationId, dtl.SeqNO);
                    if (findOne != null)
                    {
                        findOne.hesuandanwei = dtl.hesuandanwei;
                        findOne.shuliang     = dtl.shuliang;
                        findOne.danjia       = dtl.danjia;
                    }
                    db.SaveChanges();
                }
            }

            return(Json(""));
        }
Пример #22
0
        private void button2_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = @"C:\Users\huohaitao\Desktop\导入需求书";
            openFileDialog1.Multiselect      = true;
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (var db = new PurchaseEntities())
                {
                    foreach (string filename in openFileDialog1.FileNames)
                    {
                        textBox1.Text = filename;
                        MSExcelUtil msExcelUtil = new MSExcelUtil();
                        Workbook    workbook    = msExcelUtil.OpenExcelByMSExcel(filename);
                        Worksheet   sheet       = workbook.ActiveSheet;
                        int         rowIndex    = 2;
                        string      type        = null;
                        do
                        {
                            type = msExcelUtil.GetCellValue(sheet, 1, rowIndex);
                            string content  = msExcelUtil.GetCellValue(sheet, 2, rowIndex);
                            string childChk = msExcelUtil.GetCellValue(sheet, 3, rowIndex);
                            if (string.IsNullOrEmpty(content))
                            {
                                continue;
                            }

                            string[] items = content.Split('/');
                            foreach (string item in items)
                            {
                                HiddenCode code = new HiddenCode();
                                code.Type = type.Trim();
                                code.Code = item.Trim();
                                code.Name = item.Trim();
                                if (item == "不限制" || item == "不涉及")
                                {
                                    code.InDateTime = DateTime.MaxValue;
                                }
                                else
                                {
                                    code.InDateTime = DateTime.Now;
                                }
                                code.InUserId = "sysadmin";
                                code.UseChk   = true;

                                if (db.HiddenCode.Find(type, item) == null)
                                {
                                    db.HiddenCode.Add(code);
                                }
                                if (db.HiddenCodeType.Where(x => x.TypName == code.Type).Count() == 0)
                                {
                                    db.HiddenCodeType.Add(new HiddenCodeType()
                                    {
                                        InDateTime = DateTime.Now,
                                        InUserId   = "sysadmin",
                                        TypName    = code.Type,
                                        ChildChk   = string.IsNullOrEmpty(childChk) ? false : Convert.ToBoolean(childChk),
                                    });
                                    db.SaveChanges();
                                }
                            }

                            rowIndex++;
                        } while (!string.IsNullOrEmpty(type));
                        try
                        {
                            db.SaveChanges();
                        }
                        catch (DbEntityValidationException dex)
                        {
                            MessageBox.Show(dex.Message);
                        }

                        MessageBox.Show("导入完成");
                    }
                }
            }
        }
Пример #23
0
        public ActionResult QuotationGroupCopy(string SourceGroupId, string TargetGroupId, string ProjectId)
        {
            int seqNo = 0;
            //Biancheng
            List <Quotation_BianChengDto> bianchengList = quotationService.Quotation_BianChengCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_BianChengDto dto in bianchengList)
            {
                Quotation_Biancheng_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Biancheng_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Biancheng", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Biancheng_Dtl.Add(dtl);
            }
            //ZhiXing
            seqNo = 0;
            List <Quotation_ZhiXingDto> zhixingList = quotationService.Quotation_ZhiXingCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_ZhiXingDto dto in zhixingList)
            {
                Quotation_Zhixing_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Zhixing_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Zhixing", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Zhixing_Dtl.Add(dtl);
            }
            //Fuhe
            seqNo = 0;
            List <Quotation_FuHeDto> fuheList = quotationService.Quotation_FuHeCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_FuHeDto dto in fuheList)
            {
                Quotation_Fuhe_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Fuhe_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Fuhe", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Fuhe_Dtl.Add(dtl);
            }
            //Yanjiu
            seqNo = 0;
            List <Quotation_YanJiuDto> yanjiuList = quotationService.Quotation_YanJiuCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_YanJiuDto dto in yanjiuList)
            {
                Quotation_Yanjiu_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Yanjiu_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Yanjiu", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Yanjiu_Dtl.Add(dtl);
            }
            //Qita1
            seqNo = 0;
            List <Quotation_QiTa1Dto> qita1List = quotationService.Quotation_QiTa1CopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_QiTa1Dto dto in qita1List)
            {
                Quotation_Qita1_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Qita1_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Qita1", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Qita1_Dtl.Add(dtl);
            }
            //Qita2
            seqNo = 0;
            List <Quotation_QiTa2Dto> qita2List = quotationService.Quotation_QiTa2CopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_QiTa2Dto dto in qita2List)
            {
                Quotation_Qita2_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Qita2_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Qita2", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Qita2_Dtl.Add(dtl);
            }
            //Chezhan
            seqNo = 0;
            List <Quotation_CheZhanDto> chezhanList = quotationService.Quotation_ChezhanCopySearch(TargetGroupId, SourceGroupId);

            foreach (Quotation_CheZhanDto dto in chezhanList)
            {
                Quotation_Chezhan_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Chezhan_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.IndateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Chezhan", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Chezhan_Dtl.Add(dtl);
            }
            //Zhichi
            seqNo = 0;
            List <ZhiChi01Dto> zhichiList = quotationService.Quotation_ZhichiCopySearch(TargetGroupId, SourceGroupId);

            foreach (ZhiChi01Dto dto in zhichiList)
            {
                Quotation_Zhichi_Dtl dtl = AutoMapperHelper.MapTo <Quotation_Zhichi_Dtl>(dto);
                seqNo++;
                dtl.SeqNO       = seqNo;
                dtl.InDateTime  = DateTime.Now;
                dtl.InUserId    = UserInfo.UserId;
                dtl.QuotationId = SaveQuotationMst("Zhichi", ProjectId, dto.SupplierId, TargetGroupId);
                db.Quotation_Zhichi_Dtl.Add(dtl);
            }
            db.SaveChanges();

            return(Json(""));
        }