public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AgencyCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AgencyDescription?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AgencyAddress?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (IsSelected.GetHashCode());
            hashCode = hashCode * -1521134295 + (Rating?.GetHashCode() ?? 0);
            return(hashCode);
        }
Esempio n. 2
0
    protected void btnSave_Command(object sender, CommandEventArgs e)
    {
        agency.Name = tbxName.Text.Trim();
        agency.Country = tbxCountry.Text.Trim();
        agency.City = tbxCity.Text.Trim();
        agency.Address = tbxStreet.Text.Trim();
        agency.ContactPhone = tbxContactPhone.Text.Trim();
        agency.ContactEmail = tbxContactEmail.Text.Trim();
        agency.UrlWebsite = tbxUrlWebsite.Text.Trim();
        agency.Private = rbtnList.SelectedValue == "p" ? true : false;
        agency.LangaugeId = int.Parse(ddlLanguage.SelectedValue);

        var currdesc = agency.AgencyDescriptions.Where(i => i.LanguageId == agency.LangaugeId).SingleOrDefault();
        if (currdesc != null)
        {
            currdesc.Description = tbxDescription.Text.Trim();
        }
        else
        {
            var description = new AgencyDescription
            {
                Agency = agency,
                LanguageId = agency.LangaugeId,
                Description = tbxDescription.Text.Trim()
            };
            dc.AgencyDescriptions.InsertOnSubmit(description);
        }

        Validate();
        if (IsValid)
        {
            switch (e.CommandName)
            {
                case "edit":

                    UploadAndSetLogo(agency);
                    dc.SubmitChanges();
                    //Ovo treba lokalizirati
                    HttpContext.Current.Items["statusmessage"] = "Spremljene promjene";
                    Server.Transfer(string.Format("/Manage/Agency.aspx?agencyId={0}&action=entrysuccess", agency.Id));
                    break;
                case "new":
                    dc.SubmitChanges();
                    UploadAndSetLogo(agency);
                    dc.SubmitChanges();
                    HttpContext.Current.Items["statusmessage"] = "Unos uspješan";
                    Server.Transfer(string.Format("/Manage/Agency.aspx?agencyId={0}&action=entrysuccess", agency.Id));
                    break;
                default:
                    break;
            }
        }
    }