コード例 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        HttpPostedFile files = fuQualify.PostedFile;

        if (files.ContentLength <= 0 || !files.FileName.EndsWith(".rar"))
        {
            mbMsg.ShowMsg("必须上传相关附件且只能是.rar文件!", System.Drawing.Color.Red);
        }
        else
        {
            mbMsg.HideMsg();
            CompanyQualification q = new CompanyQualification();
            int comId = int.Parse(Request.QueryString["ID"]);
            q.CompanyID           = comId;
            q.CreateTime          = DateTime.Now;
            q.CreateUser          = Profile.AccountInfo.UserID;
            q.QualificationDesc   = txtDesc.Text.Trim();
            q.QualificationName   = txtName.Text;
            q.QualificationStatus = ComponentStatus.Enabled;
            q.UpdateTime          = DateTime.Now;
            q.UpdateUser          = Profile.AccountInfo.UserID;
            q.QualificationFile   = files.FileName;
            CompanyQualifications.AddFile(q, files.InputStream);
            mbMsg.ShowMsg("成功新增一份资质文件!", System.Drawing.Color.Navy);
            txtName.Text = string.Empty;
            txtDesc.Text = string.Empty;
            BindQualify();
        }
    }
コード例 #2
0
        public async Task <CompanyDTO> QualifyCompany(QualifyCompanyDTO QualifyCompanyDTO)
        {
            Company company = await db.Companies.FindAsync(QualifyCompanyDTO.CompanyId);

            CompanyQualification companyQualification = await db.CompanyQualifications.FindAsync(QualifyCompanyDTO.CompanyQualificationId);

            if (company == null)
            {
                throw new Exception("Id компании не правильная");
            }
            if (companyQualification == null)
            {
                throw new Exception("Id кваливикации не правильная");
            }
            if (company.QualificationId == QualifyCompanyDTO.CompanyQualificationId)
            {
                throw new Exception("Компания " + company.TradingName + " уже " + companyQualification.QualificationName);
            }
            company.QualificationId = companyQualification.Id;
            company.QualifiedDate   = DateTime.Now;
            db.Companies.Update(company);
            await db.SaveChangesAsync();

            return(await GetCompany(company.Id));
        }
コード例 #3
0
ファイル: CompanyController.cs プロジェクト: Amangeldi/CRM
        public async Task <ActionResult <CompanyViewModel> > GetCompany(int CompanyId)
        {
            CompanyDTO company = await companyServ.GetCompany(CompanyId);

            CountryDTO country = await countryServ.GetCountry(company.HGBasedInCountryId);

            CompanyQualification companyQualification = qualificationServ.GetQualifications().Result.Where(p => p.Id == company.QualificationId).FirstOrDefault();
            string userName = "";

            if (company.LeadOwnerId != null)
            {
                userName = await userRegistrationServ.GetUserFullName(company.LeadOwnerId);
            }
            string region = await regionServ.GetRegionName(country.RegionId);

            CompanyViewModel companyView = new CompanyViewModel
            {
                CompanyLegalName     = company.CompanyLegalName,
                CompanyRegion        = region,
                HGBasedInCountryName = country.Name,
                Id = company.Id,
                LeadOwnerFullName = userName,
                QualificationName = companyQualification.QualificationName,
                QualifiedDate     = company.QualifiedDate,
                TradingName       = company.TradingName,
                Website           = company.Website
            };

            return(Ok(companyView));
        }
コード例 #4
0
        public async Task <IEnumerable <CompanyDTO> > GetQualifiedCompanies()
        {
            CompanyQualification companyQualification = await db.CompanyQualifications.Where(p => p.QualificationName == "Qualified").FirstOrDefaultAsync();

            IEnumerable <CompanyDTO> QualifiedCompanies = await GetCompanies();

            return(QualifiedCompanies.Where(p => p.QualificationId == companyQualification.Id));
        }
コード例 #5
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        CompanyQualification qualification = new CompanyQualification();

        qualification.CompanyID         = 1;
        qualification.QualificationDesc = "Qualification Desc";
        qualification.QualificationName = System.IO.Path.GetFileName(FileUpload1.FileName);

        CompanyQualifications.AddFile(qualification, FileUpload1.PostedFile.InputStream);
    }
コード例 #6
0
    protected void egvQualify_RowEditing(object sender, GridViewEditEventArgs e)
    {
        btnEdit.Visible = true;
        int id = int.Parse(egvQualify.DataKeys[e.NewEditIndex].Value.ToString());

        hfCurID.Value = id.ToString();
        CompanyQualification cq = CompanyQualifications.GetCompanyQualification(id);

        txtName.Text = cq.QualificationName;
        txtDesc.Text = cq.QualificationDesc;

        ltUpload.Text = "<div>当前附件:<a style='color:#0000ff' href='" + cq.Url + "' target='_blank'>" + cq.File.FileName + "</a></div>";
    }
コード例 #7
0
        public static CompanyQualification PopulateQualificationFromIDataReader(IDataReader dr)
        {
            CompanyQualification qualification = new CompanyQualification();

            qualification.QualificationID     = DataRecordHelper.GetInt32(dr, "QualificationID");
            qualification.CompanyID           = DataRecordHelper.GetInt32(dr, "CompanyID");
            qualification.QualificationFile   = DataRecordHelper.GetString(dr, "QualificationFile");
            qualification.QualificationName   = DataRecordHelper.GetString(dr, "QualificationName");
            qualification.QualificationDesc   = DataRecordHelper.GetString(dr, "QualificationDesc");
            qualification.QualificationMemo   = DataRecordHelper.GetString(dr, "QualificationMemo");
            qualification.QualificationStatus = (ComponentStatus)DataRecordHelper.GetInt32(dr, "QualificationStatus");
            qualification.CreateTime          = DataRecordHelper.GetDateTime(dr, "CreateTime");
            qualification.CreateUser          = DataRecordHelper.GetInt32(dr, "CreateUser");
            qualification.UpdateTime          = DataRecordHelper.GetDateTime(dr, "UpdateTime");
            qualification.UpdateUser          = DataRecordHelper.GetInt32(dr, "UpdateUser");
            return(qualification);
        }
コード例 #8
0
        public async Task <CompanyRegistrationDTO> CreateCompany(CompanyRegistrationDTO CompanyRegistrationDTO)
        {
            CompanyQualification NewCompany = await db.CompanyQualifications.Where(p => p.QualificationName == "NewCompany").FirstOrDefaultAsync();

            var country = await countryServ.GetCountry(CompanyRegistrationDTO.HGBasedInCountryId);

            if (country == null)
            {
                throw new Exception("Id Страны не правильная");
            }
            Company company;

            if (CompanyRegistrationDTO.CompanyLinkedinLink != null)
            {
                Linkedin linkedin = new Linkedin {
                    FullLink = CompanyRegistrationDTO.CompanyLinkedinLink
                };
                await db.Linkedins.AddAsync(linkedin);

                company = new Company
                {
                    CompanyLegalName   = CompanyRegistrationDTO.CompanyLegalName,
                    HGBasedInCountryId = CompanyRegistrationDTO.HGBasedInCountryId,
                    Qualification      = NewCompany,
                    TradingName        = CompanyRegistrationDTO.TradingName,
                    Website            = CompanyRegistrationDTO.Website,
                    CompanyLinkedin    = linkedin
                };
            }
            else
            {
                company = new Company
                {
                    CompanyLegalName   = CompanyRegistrationDTO.CompanyLegalName,
                    HGBasedInCountryId = CompanyRegistrationDTO.HGBasedInCountryId,
                    Qualification      = NewCompany,
                    TradingName        = CompanyRegistrationDTO.TradingName,
                    Website            = CompanyRegistrationDTO.Website
                };
            }
            await db.Companies.AddAsync(company);

            await db.SaveChangesAsync();

            return(CompanyRegistrationDTO);
        }
コード例 #9
0
        public async Task <bool> SetQualified(int CompanyId)
        {
            CompanyQualification companyQualification = await db.CompanyQualifications.Where(p => p.QualificationName == "Qualified").FirstOrDefaultAsync();

            QualifyCompanyDTO qualifyCompanyDTO = new QualifyCompanyDTO {
                CompanyId = CompanyId, CompanyQualificationId = companyQualification.Id
            };

            try
            {
                await QualifyCompany(qualifyCompanyDTO);
            }
            catch
            {
                return(false);
            }
            return(true);
        }
コード例 #10
0
        public async Task <CompanyRegistrationDTO> CreateCompany(CompanyRegistrationDTO CompanyRegistrationDTO)
        {
            CompanyQualification NewCompany = qualificationServ.GetQualifications().Result.Where(p => p.QualificationName == "NewCompany").FirstOrDefault();
            var country = countryServ.GetCountry(CompanyRegistrationDTO.HGBasedInCountryId);

            if (country == null)
            {
                throw new Exception("Id Страны не правильная");
            }
            Company company = new Company
            {
                CompanyLegalName   = CompanyRegistrationDTO.CompanyLegalName,
                HGBasedInCountryId = CompanyRegistrationDTO.HGBasedInCountryId,
                Qualification      = NewCompany,
                TradingName        = CompanyRegistrationDTO.TradingName,
                Website            = CompanyRegistrationDTO.Website
            };
            await db.Companies.AddAsync(company);

            await db.SaveChangesAsync();

            return(CompanyRegistrationDTO);
        }
コード例 #11
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        int id = 0;

        if (!string.IsNullOrEmpty(hfCurID.Value))
        {
            id = int.Parse(hfCurID.Value);
        }
        if (id == 0)
        {
            mbMsg.ShowMsg("没有可编辑的对象!", System.Drawing.Color.Red);
        }
        else
        {
            HttpPostedFile files = fuQualify.PostedFile;
            if (files.ContentLength > 0 && !files.FileName.EndsWith(".rar"))
            {
                mbMsg.ShowMsg("必须上传相关附件且只能是.rar文件!", System.Drawing.Color.Red);
                return;
            }

            CompanyQualification cq = CompanyQualifications.GetCompanyQualification(id);
            if (files.ContentLength == 0)
            {
                cq.QualificationFile = cq.QualificationName;
            }
            cq.QualificationName = txtName.Text.Trim();
            cq.QualificationDesc = txtDesc.Text.Trim();
            CompanyQualifications.EditFile(cq, files.ContentLength == 0 ? null : files.InputStream);

            mbMsg.ShowMsg("成功编辑当前资质文件!", System.Drawing.Color.Navy);
            BindQualify();
            txtName.Text  = string.Empty;
            txtDesc.Text  = string.Empty;
            ltUpload.Text = string.Empty;
        }
    }
コード例 #12
0
    protected void Button14_Click(object sender, EventArgs e)
    {
        CompanyQualification qualification = CompanyQualifications.GetCompanyQualification(6);

        HyperLink1.NavigateUrl = qualification.Url;
    }
コード例 #13
0
 public abstract int UpdateQualification(CompanyQualification qualification);
コード例 #14
0
        public static async Task Initialize(UserManager <User> userManager, ApiContext context, RoleManager <IdentityRole> roleManager)
        {
            string adminEmail = "*****@*****.**";
            string password   = "******";

            if (await userManager.FindByNameAsync(adminEmail) == null)
            {
                await roleManager.CreateAsync(new IdentityRole("admin"));

                await roleManager.CreateAsync(new IdentityRole("lead"));

                await roleManager.CreateAsync(new IdentityRole("client"));

                User admin = new User {
                    Email = adminEmail, UserName = adminEmail
                };
                await userManager.CreateAsync(admin, password);

                await userManager.AddToRoleAsync(admin, "admin");

                User lead = new User {
                    Email = "*****@*****.**", UserName = "******", FirstName = "Dustin", LastName = "Carroll"
                };
                await userManager.CreateAsync(lead, password);

                await userManager.AddToRoleAsync(lead, "lead");

                User client = new User {
                    Email = "*****@*****.**", UserName = "******", FirstName = "John", LastName = "Hale"
                };
                await userManager.CreateAsync(client, password);

                await userManager.AddToRoleAsync(client, "client");

                User admin1 = new User {
                    Email = "*****@*****.**", UserName = "******", FirstName = "Douglas", LastName = "Henry"
                };
                await userManager.CreateAsync(admin1, password);

                await userManager.AddToRoleAsync(admin1, "admin");

                User client1 = new User {
                    Email = "*****@*****.**", UserName = "******", FirstName = "Dale", LastName = "Hopkins"
                };
                await userManager.CreateAsync(client1, password);

                await userManager.AddToRoleAsync(client1, "client");

                Region Africa = new Region {
                    Name = "Africa"
                };
                Region Antarctica = new Region {
                    Name = "Antarctica"
                };
                Region AsiaPacific = new Region {
                    Name = "Asia/Pacifig"
                };
                Region Europe = new Region {
                    Name = "Europe"
                };
                Region NorthAmerica = new Region {
                    Name = "North America"
                };
                Region SouthAmerica = new Region {
                    Name = "South America"
                };
                await context.Regions.AddRangeAsync(Africa, Antarctica, AsiaPacific, Europe, NorthAmerica, SouthAmerica);

                Country Australia = new Country {
                    Capital = "Canberra", Name = "Australia", Region = AsiaPacific
                };
                Country Germany = new Country {
                    Capital = "Berlin", Name = "Germany", Region = Europe
                };
                Country Slovakia = new Country {
                    Capital = "Bratislava", Name = "Slovakia", Region = Europe
                };
                Country USA = new Country {
                    Capital = "Washington", Name = "Unated States", Region = NorthAmerica
                };
                Country TM = new Country {
                    Capital = "Ashgabat", Name = "Turkmenistan", Region = AsiaPacific
                };
                await context.Countries.AddRangeAsync(Australia, Germany, Slovakia, USA);

                CompanyQualification Qualified = new CompanyQualification {
                    QualificationName = "Qualified"
                };
                CompanyQualification NotQualified = new CompanyQualification {
                    QualificationName = "NotQualified"
                };
                CompanyQualification NewCompany = new CompanyQualification {
                    QualificationName = "NewCompany"
                };
                await context.CompanyQualifications.AddRangeAsync(Qualified, NotQualified, NewCompany);

                Linkedin SlastininLinkedin = new Linkedin {
                    FullLink = "linkedin.com/in/aleksandr-slastinin-379654183/"
                };
                Linkedin TTRLinkedin = new Linkedin {
                    FullLink = "linkedin.com/company/turkmen-tranzit/"
                };
                Linkedin TTWLinkedin = new Linkedin {
                    FullLink = "linkedin.com/company/ttweb/"
                };
                await context.Linkedins.AddRangeAsync(SlastininLinkedin, TTRLinkedin, TTWLinkedin);

                await context.SaveChangesAsync();

                Contact contact1 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact2 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact3 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact4 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact5 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact6 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact7 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact8 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact9 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact10 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact11 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact contact12 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact TtrContact1 = new Contact
                {
                    Email     = "*****@*****.**",
                    FirstName = "Aleksandr",
                    Position  = "department head",
                    Surname   = "Slastinin",
                    Linkedin  = SlastininLinkedin
                };
                Contact TtrContact2 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact TtrContact3 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact TtwebContact1 = new Contact
                {
                    Email     = "*****@*****.**",
                    FirstName = "Irada",
                    Position  = "Project Manager",
                    Surname   = "davletowa",
                };
                Contact TtwebContact2 = new Contact {
                    Email = "*****@*****.**"
                };
                Contact TtwebContact3 = new Contact {
                    Email = "*****@*****.**"
                };

                await context.Contacts.AddRangeAsync(contact1, contact2, contact3, contact4, contact5, contact6, contact7, contact8, contact9, contact10, contact11, contact12, TtrContact1, TtrContact2, TtrContact3, TtwebContact1, TtwebContact2, TtwebContact3);

                await context.SaveChangesAsync();

                Company ACN = new Company
                {
                    CompanyLegalName = "ATM ATM Pty Ltd",
                    HGBasedInCountry = Australia,
                    Qualification    = Qualified,
                    TradingName      = "A.C.N.",
                    Website          = "b24.turkmen-tranzit.com"
                };
                await context.Companies.AddAsync(ACN);

                CompanyContactLink ContactACN1 = new CompanyContactLink
                {
                    Company = ACN,
                    Contact = contact1
                };
                CompanyContactLink ContactACN2 = new CompanyContactLink
                {
                    Company = ACN,
                    Contact = contact2
                };
                CompanyContactLink ContactACN3 = new CompanyContactLink
                {
                    Company = ACN,
                    Contact = contact3
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactACN1, ContactACN2, ContactACN3);

                Company ATM = new Company
                {
                    CompanyLegalName = "A.C.N. 605 479 678 Pty Ltd",
                    HGBasedInCountry = Australia,
                    Qualification    = Qualified,
                    TradingName      = "ATM",
                    LeadOwner        = lead,
                    QualifiedDate    = DateTime.Now,
                    Website          = "ttweb.org/blog"
                };
                await context.Companies.AddAsync(ATM);

                CompanyContactLink ContactATM1 = new CompanyContactLink
                {
                    Company = ATM,
                    Contact = contact4
                };
                CompanyContactLink ContactATM2 = new CompanyContactLink
                {
                    Company = ATM,
                    Contact = contact5
                };
                CompanyContactLink ContactATM3 = new CompanyContactLink
                {
                    Company = ATM,
                    Contact = contact6
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactATM1, ContactATM2, ContactATM3);

                Company Pay = new Company
                {
                    CompanyLegalName = "24-pay s.r.o",
                    HGBasedInCountry = Australia,
                    Qualification    = NotQualified,
                    TradingName      = "24 Pay SRO",
                    LeadOwner        = lead,
                    Website          = "24-pay.sk"
                };
                await context.Companies.AddAsync(Pay);

                CompanyContactLink ContactPay1 = new CompanyContactLink
                {
                    Company = Pay,
                    Contact = contact7
                };
                CompanyContactLink ContactPay2 = new CompanyContactLink
                {
                    Company = Pay,
                    Contact = contact8
                };
                CompanyContactLink ContactPay3 = new CompanyContactLink
                {
                    Company = Pay,
                    Contact = contact9
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactPay1, ContactPay2, ContactPay3);

                Company Ttz = new Company
                {
                    CompanyLegalName = "HO ''Turkmen-Tranzit''",
                    HGBasedInCountry = TM,
                    Qualification    = NewCompany,
                    TradingName      = "Turkmen-Tranzit",
                    Website          = "Turkmen-Tranzit.com",
                    CompanyLinkedin  = TTRLinkedin
                };
                await context.Companies.AddAsync(Ttz);

                CompanyContactLink ContactTtz1 = new CompanyContactLink
                {
                    Company = Ttz,
                    Contact = TtrContact1
                };
                CompanyContactLink ContactTtz2 = new CompanyContactLink
                {
                    Company = Ttz,
                    Contact = TtrContact2
                };
                CompanyContactLink ContactTtz3 = new CompanyContactLink
                {
                    Company = Ttz,
                    Contact = TtrContact3
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactTtz1, ContactTtz2, ContactTtz3);

                await context.SaveChangesAsync();

                Company Ttw = new Company
                {
                    CompanyLegalName = "HO ''Turkmen-Tranzit'' -> TTWeb",
                    HGBasedInCountry = TM,
                    Qualification    = Qualified,
                    TradingName      = "TtWeb",
                    Website          = "Ttweb.org",
                    CompanyLinkedin  = TTWLinkedin
                };
                await context.Companies.AddAsync(Ttw);

                CompanyContactLink ContactTtw1 = new CompanyContactLink
                {
                    Company = Ttw,
                    Contact = TtwebContact1
                };
                CompanyContactLink ContactTtw2 = new CompanyContactLink
                {
                    Company = Ttw,
                    Contact = TtwebContact2
                };
                CompanyContactLink ContactTtw3 = new CompanyContactLink
                {
                    Company = Ttw,
                    Contact = TtwebContact3
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactTtw1, ContactTtw2, ContactTtw3);

                await context.SaveChangesAsync();

                Company google = new Company
                {
                    CompanyLegalName = "google",
                    HGBasedInCountry = USA,
                    Qualification    = Qualified,
                    TradingName      = "google",
                    Website          = "google.com"
                };
                await context.Companies.AddAsync(google);

                CompanyContactLink ContactGoogle1 = new CompanyContactLink
                {
                    Company = google,
                    Contact = contact10
                };
                CompanyContactLink ContactGoogle2 = new CompanyContactLink
                {
                    Company = google,
                    Contact = contact11
                };
                CompanyContactLink ContactGoogle3 = new CompanyContactLink
                {
                    Company = google,
                    Contact = contact12
                };
                await context.CompanyContactLinks.AddRangeAsync(ContactGoogle1, ContactGoogle2, ContactGoogle3);

                Company microsoft = new Company
                {
                    CompanyLegalName = "microsoft",
                    HGBasedInCountry = USA,
                    Qualification    = Qualified,
                    TradingName      = "microsoft",
                    Website          = "microsoft.com"
                };
                await context.Companies.AddAsync(microsoft);

                AdvertisingCompany advertisingCompany = new AdvertisingCompany
                {
                    Id   = "cam_r7jfwbKo46XiS9okW",
                    Name = "ttweb"
                };

                await context.AddAsync(advertisingCompany);


                await context.SaveChangesAsync();
            }
        }