Advertisement

07.21.2007 at 09:46AM PDT, ID: 22711685
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

c# code rewrite HELP

Asked by qwekovaqwe in Microsoft Visual C#.Net, C# Programming Language, Visual Studio

please help my code c# experts
i have the following code and would like to see how YOU WOULD REWRITE IT BETTER since i am woried about easy of use/update and maintainability.

can this be written better? i am looking for cutting short long if/thens and other loops and branches, redundancies etc...

this is not the only code but is the most representative of the problems faced. your solution will be implemented to other code as well.

thank you very much for your time/trouble

here is the code: (with some NOTES: inserted to help guide you)

protected void Page_Load(object sender, EventArgs e)
      {
            // cache
            //NOTE: i think there is no way around this, and there needs to be no CACHE at the moment
            //NOTE: this will problably be reviewed laterm but now it needs to STAY
            Response.Cache.SetExpires(DateTime.Now.AddYears(-1));
            Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            Response.Cache.SetNoStore();
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            // session
            // NOTE: can't be helped, it seems (microsoft implementation)
            Session["SessionID"] = Session.SessionID.ToString();

            // read query string
            string displayEntity = "";

            // NOTE: is there a better way to do this??
            int i;
            if (int.TryParse(Request.QueryString["DisplayEntity"], out i))
            {
                  // get the id
                  displayEntity = Request.QueryString.Get("DisplayEntity");
            }
            else
            {
                  // ERROR: entity not found
                  Response.Redirect("~/Error/?Category=404&Message=EntityNotFound");
            }

            // database select
            SqlDataSource hrDataSource = new SqlDataSource();
            // connection string
            hrDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["hrConnectionString"].ToString();

            hrDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
            hrDataSource.SelectCommand = "selectEntityInformationByUID";

            // parameters
            hrDataSource.SelectParameters.Add("UID", displayEntity);

            // try?
            DataView dv = (DataView)hrDataSource.Select(DataSourceSelectArguments.Empty);

            if (dv.Count == 0)
            {
                  // ERROR: entity not found
                  Response.Redirect("~/Error/?Category=404&Message=EntityNotFound");
            }

            // NOTE: can this be done in another way, because in this case there can be only ONE result
            // so the for-each is not needed
            foreach (DataRowView drv in dv)
            {

                  // TODO: log access to an entity page
                  // NOTE: not yet implemented (don't worry about this)

                  // NOTE: is there an easier way to read all of these, rather than doing it manualy in the
                  // NOTE: hundreds of lines bellow??
                  string UID = drv["UID"].ToString();

                  bool ListingService = (bool)drv["ListingService"];
                  bool ListingPlusService = (bool)drv["ListingPlusService"];
                  bool BusinessService = (bool)drv["BusinessService"];

                  // read listing
                  string NationalID = drv["NationalID"].ToString();
                  string ShortName = drv["ShortName"].ToString();
                  string FullName = drv["FullName"].ToString();
                  string ClassificationDesignation = drv["ClassificationDesignation"].ToString();
                  string StreetAndNumber = drv["StreetAndNumber"].ToString();
                  string PostalCode = drv["PostalCode"].ToString();
                  string MinorPlace = drv["MinorPlace"].ToString();
                  string MajorPlace = drv["MajorPlace"].ToString();
                  string County = drv["County"].ToString();
                  string Country = drv["Country"].ToString();
                  string ContactPhone = drv["ContactPhone"].ToString();

                  // read listing plus
                  string ShortDescription = drv["ShortDescription"].ToString();
                  string ContactEmail = drv["ContactEmail"].ToString();
                  string MainSite = drv["MainSite"].ToString();

                  // read business
                  string InternalSite = drv["InternalSite"].ToString();
                  string SupportPhone = drv["SupportPhone"].ToString();
                  string CriticalPhone = drv["CriticalPhone"].ToString();
                  string Telefax = drv["Telefax"].ToString();
                  string MobilePhone = drv["MobilePhone"].ToString();
                  string SupportEmail = drv["SupportEmail"].ToString();
                  string CriticalEmail = drv["CriticalEmail"].ToString();
                  string LocalSite = drv["LocalSite"].ToString();
                  string ContactSite = drv["ContactSite"].ToString();
                  string SupportSite = drv["SupportSite"].ToString();
                  string CriticalSite = drv["CriticalSite"].ToString();
                  string InvestorsSite = drv["InvestorsSite"].ToString();
                  string MondayStart1 = drv["MondayStart1"].ToString();
                  string MondayEnd1 = drv["MondayEnd1"].ToString();
                  string MondayStart2 = drv["MondayStart2"].ToString();
                  string MondayEnd2 = drv["MondayEnd2"].ToString();
                  string TuesdayStart1 = drv["TuesdayStart1"].ToString();
                  string TuesdayEnd1 = drv["TuesdayEnd1"].ToString();
                  string TuesdayStart2 = drv["TuesdayStart2"].ToString();
                  string TuesdayEnd2 = drv["TuesdayEnd2"].ToString();
                  string WednesdayStart1 = drv["WednesdayStart1"].ToString();
                  string WednesdayEnd1 = drv["WednesdayEnd1"].ToString();
                  string WednesdayStart2 = drv["WednesdayStart2"].ToString();
                  string WednesdayEnd2 = drv["WednesdayEnd2"].ToString();
                  string ThursdayStart1 = drv["ThursdayStart1"].ToString();
                  string ThursdayEnd1 = drv["ThursdayEnd1"].ToString();
                  string ThursdayStart2 = drv["ThursdayStart2"].ToString();
                  string ThursdayEnd2 = drv["ThursdayEnd2"].ToString();
                  string FridayStart1 = drv["FridayStart1"].ToString();
                  string FridayEnd1 = drv["FridayEnd1"].ToString();
                  string FridayStart2 = drv["FridayStart2"].ToString();
                  string FridayEnd2 = drv["FridayEnd2"].ToString();
                  string SaturdayStart1 = drv["SaturdayStart1"].ToString();
                  string SaturdayEnd1 = drv["SaturdayEnd1"].ToString();
                  string SaturdayStart2 = drv["SaturdayStart2"].ToString();
                  string SaturdayEnd2 = drv["SaturdayEnd2"].ToString();
                  string SundayStart1 = drv["SundayStart1"].ToString();
                  string SundayEnd1 = drv["SundayEnd1"].ToString();
                  string SundayStart2 = drv["SundayStart2"].ToString();
                  string SundayEnd2 = drv["SundayEnd2"].ToString();
                  bool Cash = (bool)drv["Cash"];
                  bool Checks = (bool)drv["Checks"];
                  bool AmericanExpress = (bool)drv["AmericanExpress"];
                  bool DinersClub = (bool)drv["DinersClub"];
                  bool MasterCard = (bool)drv["MasterCard"];
                  bool Visa = (bool)drv["Visa"];
                  bool Invoice = (bool)drv["Invoice"];
                  string OtherPayements = drv["OtherPayements"].ToString();
                  string BankAccount = drv["BankAccount"].ToString();
                  string BankName = drv["BankName"].ToString();

                  // display listing
                  Page.Title = ShortName + " « Detaljne Informacije « OpenBiz";
                  EntityHeaderTitleShortName.Text = ShortName;
                  Bar_EntityLinkShortName.Text = ShortName;
                  EntityDetailsFullName.Text = FullName;

                  // NOTE: is there a way for the following line to be permanently on the PAGE, not in code
                  // NOTE: since it does not change, except the DisplayEntity
                  // NOTE: how to do it?? if possible?
                        Bar_EntityLink.NavigateUrl = "~/Entity/?DisplayEntity=" + UID;

                  // NOTE: is there a way to bind other stuff too to a certain variable, and not do it in code?
                  // NOTE: if possible? like the following line.
                  EntityDetailsNationalID.Text = NationalID;

                  // NOTE: a better way of doing this, if exists?
                  // NOTE: generating an address
                  EntityDetailsAddressStreet.Text = StreetAndNumber;
                  if (MinorPlace.Length > 0)
                  {
                        EntityDetailsAddressMinorPlace.Text = MinorPlace;
                  }
                  EntityDetailsAddressPostalCodeAndMajorPlace.Text = PostalCode + " " + MajorPlace;
                  EntityDetailsAddressCounty.Text = County;
                  EntityDetailsAddressCountry.Text = Country;

                  if (ContactPhone.Length > 0)
                  {
                        EntityDetailsPhoneContactPanel.Visible = true;
                        EntityDetailsPhoneContact.Text = ContactPhone;
                  }
                  else
                  {
                        EntityDetailsPhonePanel.Visible = false;
                        EntityDetailsPhoneContactPanel.Visible = false;
                  }

                  EntityLogoImage.Visible = false;

                  // display customer
                  if (ListingService)
                  {
                        EntitySideBarMenuEntryInformationSource.Visible = true;
                  }
                  else
                  {
                        EntitySideBarMenuEntryInformationSource.Visible = false;
                  }

                  // display listing plus
                  if (ListingPlusService)
                  {
                        EntityDetailsShortDescription.Text = ShortDescription;
                        EntityDetailsShortDescriptionPanel.Visible = true;

                        if (MainSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetMainSitePanel.Visible = true;
                              EntityDetailsInternetMainSiteLink.NavigateUrl = "http://" + MainSite;
                              EntityDetailsInternetMainSite.Text = MainSite;
                        }
                        else
                        {
                              EntityDetailsInternetMainSitePanel.Visible = false;
                              EntityDetailsInternetPanel.Visible = false;
                        }

                        if (ContactEmail.Length > 0)
                        {
                              EntityDetailsEmailPanel.Visible = true;
                              EntityDetailsEmailContactPanel.Visible = true;
                              EntityDetailsEmailContactLink.NavigateUrl = "mailto:" + ContactEmail;
                              EntityDetailsEmailContact.Text = ContactEmail;
                        }
                        else
                        {
                              EntityDetailsEmailContactPanel.Visible = false;
                              EntityDetailsEmailPanel.Visible = false;
                        }

                        // logo exists?
                        if (File.Exists(Server.MapPath("/Entity/Images/Logo/" + UID + ".jpg")))
                        {
                              EntityLogoImage.Visible = true;
                              EntityLogoImage.ImageUrl = "~/Entity/Images/Logo/" + UID + ".jpg";
                              EntityLogoImage.ToolTip = ShortName + " Logo";
                        }
                        else
                        {
                              EntityLogoImage.Visible = false;
                        }

                  }
                  else
                  {
                        EntityDetailsShortDescriptionPanel.Visible = false;
                        EntityDetailsInternetPanel.Visible = false;
                        EntityDetailsWorkingHoursPanel.Visible = false;
                        EntityDetailsBankAccountPanel.Visible = false;
                        EntityDetailsEmailPanel.Visible = false;
                  }

                  // display business
                  if (BusinessService)
                  {
                        if (InternalSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetInternalSitePanel.Visible = true;
                              EntityDetailsInternetInternalSiteLink.NavigateUrl = "http://" + InternalSite;
                              EntityDetailsInternetInternalSite.Text = InternalSite;
                        }
                        else
                        {
                              EntityDetailsInternetInternalSitePanel.Visible = false;
                        }
                        if (LocalSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetLocalSitePanel.Visible = true;
                              EntityDetailsInternetLocalSiteLink.NavigateUrl = "http://" + LocalSite;
                              EntityDetailsInternetLocalSite.Text = LocalSite;
                        }
                        else
                        {
                              EntityDetailsInternetLocalSitePanel.Visible = false;
                        }
                        if (ContactSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetContactSitePanel.Visible = true;
                              EntityDetailsInternetContactSiteLink.NavigateUrl = "http://" + ContactSite;
                              EntityDetailsInternetContactSite.Text = LocalSite;
                        }
                        else
                        {
                              EntityDetailsInternetContactSitePanel.Visible = false;
                        }
                        if (SupportSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetSupportSitePanel.Visible = true;
                              EntityDetailsInternetSupportSiteLink.NavigateUrl = "http://" + SupportSite;
                              EntityDetailsInternetSupportSite.Text = LocalSite;
                        }
                        else
                        {
                              EntityDetailsInternetSupportSitePanel.Visible = false;
                        }
                        if (CriticalSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetCriticalSitePanel.Visible = true;
                              EntityDetailsInternetCriticalSiteLink.NavigateUrl = "http://" + CriticalSite;
                              EntityDetailsInternetCriticalSite.Text = LocalSite;
                        }
                        else
                        {
                              EntityDetailsInternetCriticalSitePanel.Visible = false;
                        }
                        if (InvestorsSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                              EntityDetailsInternetInvestorsSitePanel.Visible = true;
                              EntityDetailsInternetInvestorsSiteLink.NavigateUrl = "http://" + InvestorsSite;
                              EntityDetailsInternetInvestorsSite.Text = LocalSite;
                        }
                        else
                        {
                              EntityDetailsInternetInvestorsSitePanel.Visible = false;
                        }
                        if (MainSite.Length > 0 || InternalSite.Length > 0 || LocalSite.Length > 0 || ContactSite.Length > 0 || SupportSite.Length > 0 || CriticalSite.Length > 0 || InvestorsSite.Length > 0)
                        {
                              EntityDetailsInternetPanel.Visible = true;
                        }
                        else
                        {
                              EntityDetailsInternetPanel.Visible = false;
                        }

                        if (SupportPhone.Length > 0)
                        {
                              EntityDetailsPhoneSupportPanel.Visible = true;
                              EntityDetailsPhoneSupport.Text = SupportPhone;
                        }
                        else
                        {
                              EntityDetailsPhoneSupportPanel.Visible = false;
                        }
                        if (CriticalPhone.Length > 0)
                        {
                              EntityDetailsPhoneCriticalPanel.Visible = true;
                              EntityDetailsPhoneCritical.Text = CriticalPhone;
                        }
                        else
                        {
                              EntityDetailsPhoneCriticalPanel.Visible = false;
                        }
                        if (Telefax.Length > 0)
                        {
                              EntityDetailsPhoneTelefaxPanel.Visible = true;
                              EntityDetailsPhoneTelefax.Text = Telefax;
                        }
                        else
                        {
                              EntityDetailsPhoneTelefaxPanel.Visible = false;
                        }
                        if (MobilePhone.Length > 0)
                        {
                              EntityDetailsPhoneMobilePanel.Visible = true;
                              EntityDetailsPhoneMobile.Text = MobilePhone;
                        }
                        else
                        {
                              EntityDetailsPhoneMobilePanel.Visible = false;
                        }
                        if (ContactPhone.Length > 0 || SupportPhone.Length > 0 || CriticalPhone.Length > 0 || Telefax.Length > 0 || MobilePhone.Length > 0)
                        {
                              EntityDetailsPhonePanel.Visible = true;
                        }
                        else
                        {
                              EntityDetailsPhonePanel.Visible = false;
                        }

                        if (SupportEmail.Length > 0)
                        {
                              EntityDetailsEmailPanel.Visible = true;
                              EntityDetailsEmailSupportPanel.Visible = true;
                              EntityDetailsEmailSupportLink.NavigateUrl = "mailto:" + SupportEmail;
                              EntityDetailsEmailSupport.Text = SupportEmail;
                        }
                        else
                        {
                              EntityDetailsEmailSupportPanel.Visible = false;
                        }
                        if (CriticalEmail.Length > 0)
                        {
                              EntityDetailsEmailPanel.Visible = true;
                              EntityDetailsEmailCriticalPanel.Visible = true;
                              EntityDetailsEmailCriticalLink.NavigateUrl = "mailto:" + CriticalEmail;
                              EntityDetailsEmailCritical.Text = CriticalEmail;
                        }
                        else
                        {
                              EntityDetailsEmailCriticalPanel.Visible = false;
                        }
                        if (ContactEmail.Length > 0 || SupportEmail.Length > 0 || CriticalEmail.Length > 0)
                        {
                              EntityDetailsEmailPanel.Visible = true;
                        }
                        else
                        {
                              EntityDetailsEmailPanel.Visible = false;
                        }

                        bool workingHoursNotEmpty = false;
                        if (MondayStart1.Length > 0 && MondayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursMonday1Panel.Visible = true;
                              EntityDetailsWorkingHoursMonday1.Text = MondayStart1 + " - " + MondayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursMonday1Panel.Visible = true;
                        }
                        if (TuesdayStart1.Length > 0 && TuesdayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursTuesday1Panel.Visible = true;
                              EntityDetailsWorkingHoursTuesday1.Text = TuesdayStart1 + " - " + TuesdayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursTuesday1Panel.Visible = true;
                        }
                        if (WednesdayStart1.Length > 0 && WednesdayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursWednesday1Panel.Visible = true;
                              EntityDetailsWorkingHoursWednesday1.Text = WednesdayStart1 + " - " + WednesdayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursWednesday1Panel.Visible = true;
                        }
                        if (ThursdayStart1.Length > 0 && ThursdayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursThursday1Panel.Visible = true;
                              EntityDetailsWorkingHoursThursday1.Text = ThursdayStart1 + " - " + ThursdayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursThursday1Panel.Visible = true;
                        }
                        if (FridayStart1.Length > 0 && FridayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursFriday1Panel.Visible = true;
                              EntityDetailsWorkingHoursFriday1.Text = FridayStart1 + " - " + FridayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursFriday1Panel.Visible = true;
                        }
                        if (SaturdayStart1.Length > 0 && SaturdayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursSaturday1Panel.Visible = true;
                              EntityDetailsWorkingHoursSaturday1.Text = SaturdayStart1 + " - " + SaturdayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursSaturday1Panel.Visible = true;
                        }
                        if (SundayStart1.Length > 0 && SundayEnd1.Length > 0)
                        {
                              EntityDetailsWorkingHoursSunday1Panel.Visible = true;
                              EntityDetailsWorkingHoursSunday1.Text = SundayStart1 + " - " + SundayEnd1;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursSunday1Panel.Visible = true;
                        }
                        if (MondayStart2.Length > 0 && MondayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursMonday2Panel.Visible = true;
                              EntityDetailsWorkingHoursMonday2.Text = MondayStart2 + " - " + MondayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursMonday2Panel.Visible = true;
                        }
                        if (TuesdayStart2.Length > 0 && TuesdayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursTuesday2Panel.Visible = true;
                              EntityDetailsWorkingHoursTuesday2.Text = TuesdayStart2 + " - " + TuesdayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursTuesday2Panel.Visible = true;
                        }
                        if (WednesdayStart2.Length > 0 && WednesdayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursWednesday2Panel.Visible = true;
                              EntityDetailsWorkingHoursWednesday2.Text = WednesdayStart2 + " - " + WednesdayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursWednesday2Panel.Visible = true;
                        }
                        if (ThursdayStart2.Length > 0 && ThursdayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursThursday2Panel.Visible = true;
                              EntityDetailsWorkingHoursThursday2.Text = ThursdayStart2 + " - " + ThursdayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursThursday2Panel.Visible = true;
                        }
                        if (FridayStart2.Length > 0 && FridayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursFriday2Panel.Visible = true;
                              EntityDetailsWorkingHoursFriday2.Text = FridayStart2 + " - " + FridayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursFriday2Panel.Visible = true;
                        }
                        if (SaturdayStart2.Length > 0 && SaturdayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursSaturday2Panel.Visible = true;
                              EntityDetailsWorkingHoursSaturday2.Text = SaturdayStart2 + " - " + SaturdayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursSaturday2Panel.Visible = true;
                        }
                        if (SundayStart2.Length > 0 && SundayEnd2.Length > 0)
                        {
                              EntityDetailsWorkingHoursSunday2Panel.Visible = true;
                              EntityDetailsWorkingHoursSunday2.Text = SundayStart2 + " - " + SundayEnd2;
                              workingHoursNotEmpty = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursSunday2Panel.Visible = true;
                        }
                        if (workingHoursNotEmpty)
                        {
                              EntityDetailsWorkingHoursPanel.Visible = true;
                        }
                        else
                        {
                              EntityDetailsWorkingHoursPanel.Visible = false;
                        }

                        string tempPayment = "";
                        bool paymentNotEmpty = false;
                        if (Cash)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " Gotovina";
                              paymentNotEmpty = true;
                        }
                        if (Checks)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " ekovi";
                              paymentNotEmpty = true;
                        }
                        if (AmericanExpress)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " American Express";
                              paymentNotEmpty = true;
                        }
                        if (DinersClub)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " DinersClub";
                              paymentNotEmpty = true;
                        }
                        if (MasterCard)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " MasterCard";
                              paymentNotEmpty = true;
                        }
                        if (Visa)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " Visa";
                              paymentNotEmpty = true;
                        }
                        if (Invoice)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " Predraun";
                              paymentNotEmpty = true;
                        }
                        if (OtherPayements.Length > 0)
                        {
                              if (tempPayment.Length > 0)
                              {
                                    tempPayment = tempPayment + ",";
                              }
                              tempPayment = tempPayment + " " + OtherPayements;
                              paymentNotEmpty = true;
                        }
                        if (paymentNotEmpty)
                        {
                              EntityDetailsPaymentOptionsPanel.Visible = true;
                        }
                        else
                        {
                              EntityDetailsPaymentOptionsPanel.Visible = false;
                        }
                        EntityDetailsPayementOptions.Text = tempPayment;

                        if (BankName.Length > 0 || BankAccount.Length > 0)
                        {
                              EntityDetailsBankAccountPanel.Visible = true;
                              EntityDetailsBankAccountName.Text = BankName;
                              EntityDetailsBankAccountNumber.Text = BankAccount;
                        }