Exemplo n.º 1
0
        public void CopyFrom(BEmplyee bempf)
        {
            //this.FullNameEmp = bempf.FullNameEmp;
            //this.SmallNameEmp = bempf.SmallNameEmp;
            this.NumberEmp = bempf.NumberEmp;
            //this.PinyinEmp = bempf.PinyinEmp;
            //this.bdepartment_BID = bempf.bdepartment_BID;
            //this.TelEmp = bempf.TelEmp;
            //this.StateEmp = bempf.StateEmp;
            //this.RemarkEmp = bempf.RemarkEmp;

            //this.RegisterDate = bempf.RegisterDate;
            this.RegisterMoney = bempf.RegisterMoney;
            this.TaxAtt        = bempf.TaxAtt;
            this.TenderCount   = bempf.TenderCount;
            this.TenderOKCount = bempf.TenderOKCount;
            this.PassYearCheck = bempf.PassYearCheck;
            this.LinkType      = bempf.LinkType;
            this.LinkMan       = bempf.LinkMan;
            this.LicenceAtt    = bempf.LicenceAtt;
            this.ItRemark      = bempf.ItRemark;
            this.isPass        = bempf.isPass;
            this.DescsData     = bempf.DescsData;
            this.DelegateBook  = bempf.DelegateBook;
            this.CompanyType   = bempf.CompanyType;
            this.CodeAtt       = bempf.CodeAtt;
            this.CertAtt       = bempf.CertAtt;

            this.PromiseAtt     = bempf.PromiseAtt;
            this.SecretAtt      = bempf.SecretAtt;
            this.PeopleAtt      = bempf.PeopleAtt;
            this.OpenAccountAtt = bempf.OpenAccountAtt;
            this.projectAtt     = bempf.projectAtt;
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void CopyFrom(BEmplyee bempf)
        {
            //this.FullNameEmp = bempf.FullNameEmp;
            //this.SmallNameEmp = bempf.SmallNameEmp;
            this.NumberEmp = bempf.NumberEmp;
            //this.PinyinEmp = bempf.PinyinEmp;
            //this.bdepartment_BID = bempf.bdepartment_BID;
            //this.TelEmp = bempf.TelEmp;
            //this.StateEmp = bempf.StateEmp;
            //this.RemarkEmp = bempf.RemarkEmp;

            //this.RegisterDate = bempf.RegisterDate;
            this.RegisterMoney = bempf.RegisterMoney;
            this.TaxAtt = bempf.TaxAtt;
            this.TenderCount = bempf.TenderCount;
            this.TenderOKCount = bempf.TenderOKCount;
            this.PassYearCheck = bempf.PassYearCheck;
            this.LinkType = bempf.LinkType;
            this.LinkMan = bempf.LinkMan;
            this.LicenceAtt = bempf.LicenceAtt;
            this.ItRemark = bempf.ItRemark;
            this.isPass = bempf.isPass;
            this.DescsData = bempf.DescsData;
            this.DelegateBook = bempf.DelegateBook;
            this.CompanyType = bempf.CompanyType;
            this.CodeAtt = bempf.CodeAtt;
            this.CertAtt = bempf.CertAtt;

            this.PromiseAtt = bempf.PromiseAtt;
        }
Exemplo n.º 4
0
        public ActionResult Edit(BEmplyee emp)
        {
            if (ModelState.IsValid)
            {
                int mid = emp.EmpID;
                BEmplyee emp1;
                try {
                     emp1= db.BEmplyees.Find(mid);
                }catch(Exception ex)
                {
                    return Content("用户不存在");
                }

                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 (fOpenAccountAtt != null && !String.IsNullOrEmpty(fOpenAccountAtt.FileName))
                {
                    emp.OpenAccountAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                //****************  类似项目的经营业绩 **************

                if (fprojectAtt != null && !String.IsNullOrEmpty(fprojectAtt.FileName))
                {
                    emp.projectAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }
                //****************  保密协议 **************

                if (fSecretAtt != null && !String.IsNullOrEmpty(fSecretAtt.FileName))
                {
                    emp.SecretAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                //*****************************************
                if (fPeopleAtt != null && !String.IsNullOrEmpty(fPeopleAtt.FileName))
                {
                    emp.PeopleAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fPromiseAtt != null && !String.IsNullOrEmpty(fPromiseAtt.FileName))
                {
                    emp.PromiseAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fCodeAtt != null&&!String.IsNullOrEmpty(fCodeAtt.FileName))
                {
                    emp.CodeAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fTaxAtt != null && !String.IsNullOrEmpty(fTaxAtt.FileName))
                {
                    emp.TaxAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fCertAtt != null && !String.IsNullOrEmpty(fCertAtt.FileName))
                {
                    emp.CertAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fLicenceAtt != null && !String.IsNullOrEmpty(fLicenceAtt.FileName))
                {
                    emp.LicenceAtt = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }

                if (fDelegateBook != null && !String.IsNullOrEmpty(fDelegateBook.FileName))
                {
                    emp.DelegateBook = DateTime.Now.ToString("yyyyMMdd") + Guid.NewGuid().ToString("N");
                    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 } });
                }
                emp1.CopyFrom(emp);
                db.Entry(emp1).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index", "Home");
                //return Content("修改成功!");
            }
            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 ;
                        }
                    }
                }
                return Content(err);
            }
            return Content("修改失败");
            //return View(emp);
        }