Exemplo n.º 1
0
    public void SaveCompanyHistory(Jury jury, CompanyHistory compnyHistroy, string DateCreated = "")
    {
        if (!string.IsNullOrEmpty(DateCreated) && !compnyHistroy.IsNew)
        {
            compnyHistroy.DateCreatedString = DateCreated;
        }
        else
        {
            compnyHistroy.JuryId      = jury.Id;
            compnyHistroy.Type        = jury.Type;
            compnyHistroy.Designation = jury.Designation;
            compnyHistroy.Company     = jury.Company;
            compnyHistroy.Address1    = jury.Address1;
            compnyHistroy.Address2    = jury.Address2;
            compnyHistroy.City        = jury.City;
            compnyHistroy.Postal      = jury.Postal;
            compnyHistroy.Country     = jury.Country;

            if (DateCreated == "Empty")
            {
                compnyHistroy.DateCreatedString = jury.DateCreatedString;
            }
            else if (!string.IsNullOrEmpty(DateCreated))
            {
                compnyHistroy.DateCreatedString = DateCreated;
            }

            compnyHistroy.CompanyType      = jury.CompanyType;
            compnyHistroy.CompanyTypeOther = jury.CompanyTypeOther;

            compnyHistroy.Network = jury.Network;
            if (compnyHistroy.Network == "Others")
            {
                compnyHistroy.NetworkOthers = jury.NetworkOthers.Trim();
            }

            compnyHistroy.HoldingCompany = jury.HoldingCompany;
            if (compnyHistroy.HoldingCompany == "Others")
            {
                compnyHistroy.HoldingCompanyOthers = jury.HoldingCompanyOthers.Trim();
            }
        }

        compnyHistroy.Save();

        string msg = "JURY ID : " + jury.Id + " || CompnyHistroy ID : " + compnyHistroy.Id + " || IsNew : " + compnyHistroy.IsNew + " || DateCreated : " + DateCreated + "<br>";

        Response.Write(msg);
    }
Exemplo n.º 2
0
    public void SaveCompanyHistory(Jury jury, ClosedXML.Excel.IXLRangeRow CurrentRow)
    {
        CompanyHistory compnyHistroy = CompanyHistory.NewCompanyHistory();

        compnyHistroy.JuryId      = jury.Id;
        compnyHistroy.Type        = RemoveControlChars(CurrentRow.Cell(2).GetString());
        compnyHistroy.Designation = RemoveControlChars(CurrentRow.Cell(7).GetString());
        compnyHistroy.Company     = RemoveControlChars(CurrentRow.Cell(8).GetString());

        compnyHistroy.Country            = RemoveControlChars(CurrentRow.Cell(17).GetString());
        compnyHistroy.DateModifiedString = DateTime.Now.ToString();
        compnyHistroy.Network            = RemoveControlChars(CurrentRow.Cell(9).GetString());
        compnyHistroy.HoldingCompany     = RemoveControlChars(CurrentRow.Cell(10).GetString());

        if (compnyHistroy.IsNew)
        {
            compnyHistroy.DateCreatedString = DateTime.Now.AddYears(-3).ToString();
        }

        if (compnyHistroy.IsValid)
        {
            compnyHistroy.Save();
        }
    }