Esempio n. 1
0
        public ActionResult Create(BDepartment bdepartment)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //if (db.BDepartments.Find(bdepartment.BNumber) != null)
                    //{
                    //    return RedirectToAction("Error", "MyTart", new { err = "编号不能重复", Act = "Create", Con = "BDepartment" });

                    //}
                    db.BDepartments.Add(bdepartment);

                    db.SaveChanges();

                    return(RedirectToAction("Create"));
                    //return View(new BDepartment { BNumber = bdepartment.BNumber.GetAscNumberStr() });
                }
                return(View(bdepartment));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }


            //return View(bdepartment);
        }
Esempio n. 2
0
        public ActionResult TenderRequest(int id = 0)
        {
            //************* 添加  验证  已不能审核 时间超等****
            Tender_GongGao tender_gonggao = db.Tender_GongGaos.Include("Bemp_GongGaos.bemplyees").Single(m => m.TaskID == id);

            //if (tender_gonggao != null && tender_gonggao.Bemp_GongGaos.Count > 0)
            //{
            //    //if (tender_gonggao.Bemp_GongGaos.Contains(db.Bemp_GongGaos.Single(m => m.bemplyees.NumberEmp == User.Identity.Name&&m.GongGaoId==id)))
            //    //{
            //    //    return Content("请不要重复申请");
            //    //}
            if (tender_gonggao.IsShenhe != null && tender_gonggao.IsShenhe == true)
            {
                return(Content("投标申请已结束!"));
            }
            if (tender_gonggao.Bemp_GongGaos.Where(m => m.GongGaoId == id && m.UserName == User.Identity.Name).Count() > 0)
            {
                return(Content("请不要重复申请"));
            }

            //}
            Bemp_GongGao empG = new Bemp_GongGao();

            empG.GongGaoId = id;
            empG.UserId    = db.BEmplyees.Single(emp => emp.NumberEmp == User.Identity.Name).EmpID;
            empG.UserName  = User.Identity.Name;
            tender_gonggao.Bemp_GongGaos.Add(empG);

            //db.Entry(tender_gonggao).State = EntityState.Modified;
            db.Configuration.ValidateOnSaveEnabled = false;
            db.SaveChanges();
            db.Configuration.ValidateOnSaveEnabled = true;
            return(Content("申请成功,等待审核"));
        }
Esempio n. 3
0
        public ActionResult Create(int TaskID = 1)
        {
            if (TaskID != 1)
            {
                Tender_GongGao tg = db.Tender_GongGaos.Find(TaskID);
                if (tg != null)
                {
                    if (tg.IsShenhe != true)
                    {
                        return(Content("尚未进行供应商投标审核,不能投标~!"));
                    }

                    Tender_GongGao tgonggao = db.Tender_GongGaos.Find(TaskID);
                    if (tgonggao.TenderModel != null && tgonggao.TenderModel.Trim().Equals("三轮报价模式"))
                    {
                        //return Content("您已选择三轮报价模式,不能再选择竞价模式");
                        if (db.Tender_ModelManage1.FirstOrDefault(m => m.Tid == TaskID) != null)
                        {
                            return(Content("您已选择三轮报价模式并已操作,不能再选择竞价模式"));
                        }
                    }



                    tgonggao.TenderModel     = "竞价模式";
                    db.Entry(tgonggao).State = EntityState.Modified;
                    db.SaveChanges();

                    int mcount = db.Tender_ModelManage2.Where(m => m.Tid == TaskID).Count();
                    if (mcount > 0)
                    {
                        ViewBag.ggM = tg;
                        Tender_ModelManage2 mod2 = db.Tender_ModelManage2.Single(m => m.Tid == TaskID);
                        mod2.Tid = TaskID;
                        return(View(mod2));
                        //return Content("已经投标 请不要重复投标");
                    }
                    ViewBag.ggM = tg;
                    Tender_ModelManage2 mod1 = new Tender_ModelManage2();
                    mod1.Tid       = TaskID;
                    mod1.PriceUnit = "元/标";
                    return(View(mod1));
                    //mod1.tenderGonggao = tg;
                    //ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN");
                    //return View(mod1);
                }
                else
                {
                    return(Content("请求页面异常~!"));
                }
            }
            return(Content("如有问题 请联系管理员"));
            //ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN");
            //return View();
        }
Esempio n. 4
0
        public ActionResult Create(BLinkCompany blinkcompany)
        {
            if (ModelState.IsValid)
            {
                db.BLinkCompanies.Add(blinkcompany);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(blinkcompany));
        }
Esempio n. 5
0
        public ActionResult Create(BProduct bproduct)
        {
            if (ModelState.IsValid)
            {
                db.BProducts.Add(bproduct);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(bproduct));
        }
Esempio n. 6
0
        public ActionResult Create(Permission permission)
        {
            if (ModelState.IsValid)
            {
                db.Permissions.Add(permission);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(permission));
        }
Esempio n. 7
0
        public ActionResult Create(BPartMenu bpartmenu)
        {
            if (ModelState.IsValid)
            {
                db.BPartMenus.Add(bpartmenu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(bpartmenu));
        }
Esempio n. 8
0
        public ActionResult Create(BStore bstore)
        {
            if (ModelState.IsValid)
            {
                db.BStores.Add(bstore);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(bstore));
        }
Esempio n. 9
0
        public ActionResult Create(Tender_CompanyInfo tender_companyinfo)
        {
            if (ModelState.IsValid)
            {
                db.Tender_CompanyInfo.Add(tender_companyinfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmpID = new SelectList(db.BEmplyees, "EmpID", "NumberEmp", tender_companyinfo.EmpID);
            return(View(tender_companyinfo));
        }
Esempio n. 10
0
        public ActionResult Create(Bemp_GongGao bemp_gonggao)
        {
            if (ModelState.IsValid)
            {
                db.Bemp_GongGaos.Add(bemp_gonggao);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserId    = new SelectList(db.BEmplyees, "EmpID", "NumberEmp", bemp_gonggao.UserId);
            ViewBag.GongGaoId = new SelectList(db.Tender_GongGaos, "TaskID", "SN", bemp_gonggao.GongGaoId);
            return(View(bemp_gonggao));
        }
Esempio n. 11
0
        public ActionResult Create(Tender_TongZhi custf, HttpPostedFileBase[] fileToUpload, int id = 0)
        {
            //if (ModelState.IsValid)
            //{
            //    tender_tongzhi.CreateDateT = DateTime.Now;
            //    db.Tender_TongZhi.Add(tender_tongzhi);
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}

            //return View(tender_tongzhi);
            if (id == 3)
            {
                return(Content(""));
            }

            HttpPostedFileBase file = null;

            if (fileToUpload != null)
            {
                file = fileToUpload[0];
            }
            if (file != null && !String.IsNullOrEmpty(file.FileName))
            {
                custf.CustFile = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (custf.CustFile.Substring(0, 4) + @"\" + custf.CustFile.Substring(4, 4) + @"\")));
                file.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (custf.CustFile.Substring(0, 4) + @"\" + custf.CustFile.Substring(4, 4) + @"\" + custf.CustFile.Substring(8))));
                GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                    { "@FileID", custf.CustFile, "DbType.String", null },
                    { "@Name", Path.GetFileName(file.FileName), "DbType.String", null },
                    { "@Ext", Path.GetExtension(file.FileName), "DbType.String", null },
                    { "@Size", file.ContentLength.ToString(), "DbType.Int32", null },
                    { "@OwnerAccount", "0", "DbType.String", null }
                });
                custf.CustName = Path.GetFileName(file.FileName);
            }

            custf.CreateDateT = System.DateTime.Now;

            db.Tender_TongZhi.Add(custf);
            db.SaveChanges();
            //string fPath = @"D://myupload/" + file.FileName;
            //file.SaveAs(fPath);
            //string custT="nul";
            //if(custf!=null)
            //{
            //    custT = custf.CustText;
            //}
            return(Content("保存成功"));
        }
Esempio n. 12
0
        public ActionResult Create(Role role)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Roles.Add(role);
                    db.SaveChanges();
                    //return RedirectToAction("Index");
                    Roles.AddUserToRole("海立美达", role.RoleName);

                    return(View(role));
                }

                return(View(role));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Esempio n. 13
0
        public ActionResult Create(BEmplyee bemplyee)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    WebSecurity.CreateUserAndAccount(bemplyee.NumberEmp, "111111");

                    BEmplyee emp = db.BEmplyees.Single(m => m.NumberEmp.Equals(bemplyee.NumberEmp));

                    emp.CopyFrom(bemplyee);
                    emp.RegisterDate = bemplyee.RegisterDate = System.DateTime.Now;
                    db.SaveChanges();
                    return(RedirectToAction("Create"));
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }

            //else
            //{
            //    string err = "";
            //    foreach (string k in ModelState.Keys)
            //    {
            //        if (ModelState[k].Errors.Count > 0)
            //        {
            //            err += k + "\n ";
            //            foreach (ModelError eor in ModelState[k].Errors)
            //            {
            //                err += ">>" + eor.ErrorMessage + ":" + eor.Exception.Message + "\n" + eor.Exception.StackTrace ;
            //            }
            //        }
            //    }
            //    return Content(err);
            //}

            return(View(bemplyee));
        }
Esempio n. 14
0
        public ActionResult Register(RegisterModel register)
        {
            if (ModelState.IsValid)
            {
                HttpPostedFileBase fCodeAtt      = Request.Files["fCodeAtt"];
                HttpPostedFileBase fTaxAtt       = Request.Files["fTaxAtt"];
                HttpPostedFileBase fCertAtt      = Request.Files["fCertAtt"];
                HttpPostedFileBase fLicenceAtt   = Request.Files["fLicenceAtt"];
                HttpPostedFileBase fDelegateBook = Request.Files["fDelegateBook"];
                //****************  委托书 **************
                HttpPostedFileBase fPromiseAtt     = Request.Files["fPromiseAtt"];
                HttpPostedFileBase fSecretAtt      = Request.Files["fSecretAtt"];
                HttpPostedFileBase fPeopleAtt      = Request.Files["fPeopleAtt"];
                HttpPostedFileBase fOpenAccountAtt = Request.Files["fOpenAccountAtt"];
                HttpPostedFileBase fprojectAtt     = Request.Files["fprojectAtt"];
                //****************  委托书 **************
                if (fCodeAtt == null || fTaxAtt == null || fCertAtt == null || fLicenceAtt == null || fDelegateBook == null || fPromiseAtt == null)
                {
                    return(Content("error file is null"));
                }
                if (Path.GetExtension(fCodeAtt.FileName).ToLower().EndsWith("exe") ||
                    Path.GetExtension(fTaxAtt.FileName).ToLower().EndsWith("exe") ||
                    Path.GetExtension(fCertAtt.FileName).ToLower().EndsWith("exe") ||
                    Path.GetExtension(fCertAtt.FileName).ToLower().EndsWith("exe") ||
                    //****************  委托书 **************
                    Path.GetExtension(fPromiseAtt.FileName).ToLower().EndsWith("exe") ||
                    Path.GetExtension(fDelegateBook.FileName).ToLower().EndsWith("exe"))
                {
                    return(Content("请上传办公文件或压缩文件"));
                }
                //using( TransactionScope scope=new TransactionScope())
                //{
                WebSecurity.CreateUserAndAccount(register.bemplyee.NumberEmp, register.Password);

                BEmplyee emp = db.BEmplyees.Single(m => m.NumberEmp.Equals(register.bemplyee.NumberEmp));

                emp.CopyFrom(register.bemplyee);

                //****************  保密协议 **************
                emp.SecretAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fSecretAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.SecretAtt.Substring(0, 4) + @"\" + emp.SecretAtt.Substring(4, 4) + @"\")));
                    fSecretAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.SecretAtt.Substring(0, 4) + @"\" + emp.SecretAtt.Substring(4, 4) + @"\" + emp.SecretAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.SecretAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fSecretAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fSecretAtt.FileName), "DbType.String", null },
                        { "@Size", fSecretAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                //*******************资格证明***********

                //****************  开户许可证 **************
                emp.OpenAccountAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fOpenAccountAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.OpenAccountAtt.Substring(0, 4) + @"\" + emp.OpenAccountAtt.Substring(4, 4) + @"\")));
                    fOpenAccountAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.OpenAccountAtt.Substring(0, 4) + @"\" + emp.OpenAccountAtt.Substring(4, 4) + @"\" + emp.OpenAccountAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.OpenAccountAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fOpenAccountAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fOpenAccountAtt.FileName), "DbType.String", null },
                        { "@Size", fOpenAccountAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                //****************  类似项目的经营业绩 **************
                emp.projectAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fprojectAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.projectAtt.Substring(0, 4) + @"\" + emp.projectAtt.Substring(4, 4) + @"\")));
                    fprojectAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.projectAtt.Substring(0, 4) + @"\" + emp.projectAtt.Substring(4, 4) + @"\" + emp.projectAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.projectAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fprojectAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fprojectAtt.FileName), "DbType.String", null },
                        { "@Size", fprojectAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                //****************  保密协议 **************
                emp.PeopleAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fPeopleAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.PeopleAtt.Substring(0, 4) + @"\" + emp.PeopleAtt.Substring(4, 4) + @"\")));
                    fPeopleAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.PeopleAtt.Substring(0, 4) + @"\" + emp.PeopleAtt.Substring(4, 4) + @"\" + emp.PeopleAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.PeopleAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fPeopleAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fPeopleAtt.FileName), "DbType.String", null },
                        { "@Size", fPeopleAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                //****************  委托书 **************
                emp.PromiseAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fPromiseAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.PromiseAtt.Substring(0, 4) + @"\" + emp.PromiseAtt.Substring(4, 4) + @"\")));
                    fPromiseAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.PromiseAtt.Substring(0, 4) + @"\" + emp.PromiseAtt.Substring(4, 4) + @"\" + emp.PromiseAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.PromiseAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fPromiseAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fPromiseAtt.FileName), "DbType.String", null },
                        { "@Size", fPromiseAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                emp.CodeAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fCodeAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.CodeAtt.Substring(0, 4) + @"\" + emp.CodeAtt.Substring(4, 4) + @"\")));
                    fCodeAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.CodeAtt.Substring(0, 4) + @"\" + emp.CodeAtt.Substring(4, 4) + @"\" + emp.CodeAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.CodeAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fCodeAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fCodeAtt.FileName), "DbType.String", null },
                        { "@Size", fCodeAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                emp.TaxAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fTaxAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.TaxAtt.Substring(0, 4) + @"\" + emp.TaxAtt.Substring(4, 4) + @"\")));
                    fTaxAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.TaxAtt.Substring(0, 4) + @"\" + emp.TaxAtt.Substring(4, 4) + @"\" + emp.TaxAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.TaxAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fTaxAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fTaxAtt.FileName), "DbType.String", null },
                        { "@Size", fTaxAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                emp.CertAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fCertAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.CertAtt.Substring(0, 4) + @"\" + emp.CertAtt.Substring(4, 4) + @"\")));
                    fCertAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.CertAtt.Substring(0, 4) + @"\" + emp.CertAtt.Substring(4, 4) + @"\" + emp.CertAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.CertAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fCertAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fCertAtt.FileName), "DbType.String", null },
                        { "@Size", fCertAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }

                emp.LicenceAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fLicenceAtt != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.LicenceAtt.Substring(0, 4) + @"\" + emp.LicenceAtt.Substring(4, 4) + @"\")));
                    fLicenceAtt.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.LicenceAtt.Substring(0, 4) + @"\" + emp.LicenceAtt.Substring(4, 4) + @"\" + emp.LicenceAtt.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.LicenceAtt, "DbType.String", null },
                        { "@Name", Path.GetFileName(fLicenceAtt.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fLicenceAtt.FileName), "DbType.String", null },
                        { "@Size", fLicenceAtt.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }


                emp.DelegateBook = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                if (fDelegateBook != null)
                {
                    Directory.CreateDirectory(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.DelegateBook.Substring(0, 4) + @"\" + emp.DelegateBook.Substring(4, 4) + @"\")));
                    fDelegateBook.SaveAs(Path.Combine(System.Web.Configuration.WebConfigurationManager.AppSettings["AttachmentRootPath"], (emp.DelegateBook.Substring(0, 4) + @"\" + emp.DelegateBook.Substring(4, 4) + @"\" + emp.DelegateBook.Substring(8))));
                    GenericDataAccess.UpdateBySql("Insert into YZAppAttachment(FileID,Name,Ext,Size,OwnerAccount) values(@FileID,@Name,@Ext,@Size,@OwnerAccount)", new string[, ] {
                        { "@FileID", emp.DelegateBook, "DbType.String", null },
                        { "@Name", Path.GetFileName(fDelegateBook.FileName), "DbType.String", null },
                        { "@Ext", Path.GetExtension(fDelegateBook.FileName), "DbType.String", null },
                        { "@Size", fDelegateBook.ContentLength.ToString(), "DbType.Int32", null },
                        { "@OwnerAccount", "0", "DbType.String", null }
                    });
                }
                emp.RegisterDate = System.DateTime.Now;
                db.SaveChanges();
                //WebSecurity.Login(emp.NumberEmp, register.Password);

                //System.Web.Routing.RouteValueDictionary routv= new System.Web.Routing.RouteValueDictionary();
                //routv.Add("EmpID","6");
                //return RedirectToAction("Create", "Tender_CompanyInfo", routv);

                //    scope.Complete();
                //}

                return(Content("注册成功!请登录"));
                //return RedirectToLocal("/");
            }
            return(View());
        }
Esempio n. 15
0
        public ActionResult Index(int id = 0)
        {
            var tender_mcust = db.Tender_ModelCustomer2.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);

            isSmall = isSmallByid(id);
            //第一次加载 生成客户初始数据
            if (tender_mcust.Count() <= 0)
            {
                List <Bemp_GongGao> list = db.Bemp_GongGaos.Include(b => b.bemplyees).Where(m => m.GongGaoId == id && m.IsPassShen != null && m.IsPassShen == true).ToList();
                if (list.Count > 0)
                {
                    lock (this)
                    {
                        foreach (Bemp_GongGao bemp in list)
                        {
                            Tender_ModelCustomer2 cust = new Tender_ModelCustomer2();
                            cust.UserName     = bemp.bemplyees.NumberEmp;
                            cust.LinkMan      = bemp.bemplyees.LinkMan;
                            cust.LinkType     = bemp.bemplyees.LinkType;
                            cust.EmpGonggaoID = bemp.BGid;
                            cust.PriceLost    = 0;

                            db.Tender_ModelCustomer2.Add(cust);
                            //li.Add(cust);
                            db.Configuration.ValidateOnSaveEnabled = false;
                            db.SaveChanges();
                            db.Configuration.ValidateOnSaveEnabled = true;
                        }
                    }
                }
            }

            //找每轮最低价
            tender_mcust   = db.Tender_ModelCustomer2.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);
            ViewBag.PriceD = 0;

            tender_mcust = db.Tender_ModelCustomer2.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id && mc.PriceLost > 0);
            if (tender_mcust.Count() > 0)
            {
                if (isSmall)
                {
                    ViewBag.PriceD = tender_mcust.Min(m => m.PriceLost);
                }
                else
                {
                    ViewBag.PriceD = tender_mcust.Max(m => m.PriceLost);
                }
            }

            if (isSmall)
            {
                foreach (Tender_ModelCustomer2 custVar in tender_mcust.ToList <Tender_ModelCustomer2>())
                {
                    Bemp_GongGao bgong = db.Bemp_GongGaos.Find(custVar.EmpGonggaoID);
                    if (bgong.LostPrice == null || (custVar.PriceLost != 0 && bgong.LostPrice > custVar.PriceLost))
                    {
                        bgong.LostPrice       = custVar.PriceLost;
                        db.Entry(bgong).State = EntityState.Modified;

                        db.SaveChanges();
                    }
                }
            }
            else
            {
                foreach (Tender_ModelCustomer2 custVar in tender_mcust.ToList <Tender_ModelCustomer2>())
                {
                    Bemp_GongGao bgong = db.Bemp_GongGaos.Find(custVar.EmpGonggaoID);
                    if (bgong.LostPrice == null || (custVar.PriceLost != 0 && bgong.LostPrice < custVar.PriceLost))
                    {
                        bgong.LostPrice       = custVar.PriceLost;
                        db.Entry(bgong).State = EntityState.Modified;

                        db.SaveChanges();
                    }
                }
            }
            ViewBag.IsSmall = isSmall;
            tender_mcust    = db.Tender_ModelCustomer2.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);
            return(View(tender_mcust.ToList()));
        }
Esempio n. 16
0
        public ActionResult Index(int id = 0)
        {
            isSmall = isSmallByid(id);
            var tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);

            //第一次加载 生成客户初始数据
            if (tender_mcust.Count() <= 0)
            {
                List <Bemp_GongGao> list = db.Bemp_GongGaos.Include(b => b.bemplyees).Where(m => m.GongGaoId == id && m.IsPassShen != null && m.IsPassShen == true).ToList();
                if (list.Count > 0)
                {
                    //List<Tender_ModelCustomer1> li = new List<Tender_ModelCustomer1>();
                    lock (this)
                    {
                        foreach (Bemp_GongGao bemp in list)
                        {
                            Tender_ModelCustomer1 cust = new Tender_ModelCustomer1();
                            cust.UserName     = bemp.bemplyees.NumberEmp;
                            cust.LinkMan      = bemp.bemplyees.LinkMan;
                            cust.LinkType     = bemp.bemplyees.LinkType;
                            cust.EmpGonggaoID = bemp.BGid;
                            cust.PriceOne     = 0;
                            cust.PriceTwo     = 0;
                            cust.PriceThree   = 0;
                            if (db.Tender_ModelCustomer1.Where(m => m.EmpGonggaoID == bemp.BGid).Count() <= 0)
                            {
                                db.Tender_ModelCustomer1.Add(cust);
                            }
                            //li.Add(cust);
                            db.Configuration.ValidateOnSaveEnabled = false;
                            db.SaveChanges();
                            db.Configuration.ValidateOnSaveEnabled = true;
                        }
                    }
                }
            }


            //找每轮最低价
            //tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);

            ViewBag.PriceD1 = ViewBag.PriceD2 = ViewBag.PriceD3 = 0;

            tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id && mc.PriceOne > 0);
            if (tender_mcust.Count() > 0)
            {
                if (isSmall)
                {
                    ViewBag.PriceD1 = tender_mcust.Min(m => m.PriceOne);
                }
                else
                {
                    ViewBag.PriceD1 = tender_mcust.Max(m => m.PriceOne);
                }
            }


            tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id && mc.PriceTwo > 0);
            if (tender_mcust.Count() > 0)
            {
                if (isSmall)
                {
                    ViewBag.PriceD2 = tender_mcust.Min(m => m.PriceTwo);
                }
                else
                {
                    ViewBag.PriceD2 = tender_mcust.Max(m => m.PriceTwo);
                }
            }


            tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id && mc.PriceThree > 0);
            if (tender_mcust.Count() > 0)
            {
                if (isSmall)
                {
                    ViewBag.PriceD3 = tender_mcust.Min(m => m.PriceThree);
                }
                else
                {
                    ViewBag.PriceD3 = tender_mcust.Max(m => m.PriceThree);
                }
            }



            //重新取数
            tender_mcust = db.Tender_ModelCustomer1.Include(t => t.bemp_Gonggao).Where(mc => mc.bemp_Gonggao.GongGaoId == id);

            if (isSmall)
            {
                //循环找最低价
                foreach (Tender_ModelCustomer1 custVar in tender_mcust.ToList <Tender_ModelCustomer1>())
                {
                    Bemp_GongGao bgong = db.Bemp_GongGaos.Find(custVar.EmpGonggaoID);
                    var          v1    = custVar.PriceOne != 0 ? custVar.PriceOne : 9999999999;
                    var          v2    = custVar.PriceTwo != 0 ? custVar.PriceTwo : 9999999999;
                    var          v3    = custVar.PriceThree != 0 ? custVar.PriceThree : 9999999999;
                    bgong.LostPrice = (v1 < v2 ? v1 : v2) < v3 ? (v1 < v2 ? v1 : v2) : v3;
                    if (bgong.LostPrice != 9999999999)
                    {
                        db.Entry(bgong).State = EntityState.Modified;
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SaveChanges();
                        db.Configuration.ValidateOnSaveEnabled = true;
                    }
                    else
                    {
                        bgong.LostPrice = 0;
                    }
                }
            }
            else
            {
                //循环找最高价
                foreach (Tender_ModelCustomer1 custVar in tender_mcust.ToList <Tender_ModelCustomer1>())
                {
                    Bemp_GongGao bgong = db.Bemp_GongGaos.Find(custVar.EmpGonggaoID);
                    var          v1    = custVar.PriceOne;
                    var          v2    = custVar.PriceTwo;
                    var          v3    = custVar.PriceThree;
                    bgong.LostPrice = (v1 > v2 ? v1 : v2) > v3 ? (v1 > v2 ? v1 : v2) : v3;
                    if (bgong.LostPrice != 0)
                    {
                        db.Entry(bgong).State = EntityState.Modified;
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SaveChanges();
                        db.Configuration.ValidateOnSaveEnabled = true;
                    }
                    else
                    {
                        bgong.LostPrice = 0;
                    }
                }
            }

            ViewBag.IsSmall = isSmall;

            return(View(tender_mcust));
        }