Beispiel #1
0
 //For Edit Country
 protected void lvCountry_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCountry")
     {
         try
         {
             labelMessage.Text = string.Empty;
             btnSave.Visible   = false;
             btnUpdate.Visible = true;
             //btnDelete.Visible = true;
             btnCancel.Visible    = true;
             chkIsRemoved.Visible = true;
             int countryID = Convert.ToInt32(e.CommandArgument);
             hdCountryID.Value = countryID.ToString();
             using (CountryRT receiverTransfer = new CountryRT())
             {
                 Country country = receiverTransfer.GetCountryByIID(countryID);
                 FillCountryForEdit(country);
             }
         }
         catch (Exception ex)
         {
             labelMessage.Text      = "Error : " + ex.Message;
             labelMessage.ForeColor = System.Drawing.Color.Red;
         }
     }
 }
        private void FillBrandForEdit(Brand brand)
        {
            try
            {
                if (brand != null)
                {
                    CountryRT recTransfer = new CountryRT();
                    txtBrandName.Text     = brand.Name;
                    txtOriginID.Text      = brand.Origin.ToString();
                    txtEstablishYear.Text = brand.EastblishYear.ToString();

                    txtOriginName.Text = Convert.ToString(recTransfer.GetCountryByIID(Convert.ToInt32(brand.Origin)).Name);
                    Session[sessBrand] = brand;
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        /// <summary>
        /// Fill Designation For Edit
        /// </summary>
        /// <param name="divisionOrState"></param>
        private void FillDesignationForEdit(DivisionOrState divisionOrState)
        {
            try
            {
                if (divisionOrState != null)
                {
                    CountryRT recTransfer = new CountryRT();
                    txtCountryID.Text = divisionOrState.CountryID.ToString();
                    txtName.Text      = divisionOrState.Name;
                    txtCode.Text      = divisionOrState.Code.ToString();

                    txtCountryName.Text            = Convert.ToString(recTransfer.GetCountryByIID(divisionOrState.CountryID).Name);
                    chkIsRemovedDivOrState.Checked = divisionOrState.IsRemoved;
                    Session[sessDivisionOrState]   = divisionOrState;
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }