protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList<ContactInfo> lstContactInfo = ContactInfoList;
                if (lstContactInfo.Count == 0)
                {
                    ContactInfo newContactInfo = new ContactInfo();
                    lstContactInfo.Add(newContactInfo);
                }
                SetDataFromControlToObj(ref lstContactInfo);
                CustomList<ContactType> lstContactType = (CustomList<ContactType>)ContactTypeList;
                CustomList<ContactTypeChild> lstContactTypeChild = (CustomList<ContactTypeChild>)ContactTypeChildList;
                CustomList<ContactDetail> lstContactDetail = (CustomList<ContactDetail>)ContactDetailList;

                if (!CheckUserAuthentication(lstContactInfo)) return;
                manager.SaveContactInfo(ref lstContactInfo, ref lstContactType, ref lstContactTypeChild, ref lstContactDetail);
                ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);
            }
            catch (SqlException ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
        private void PopulateContactInfo(ContactInfo contactInfo)
        {
            try
            {
                txtContactID.Text = contactInfo.ContactID.ToString();
                txtContactName.Text = contactInfo.Name;
                txtShortName.Text = contactInfo.ShortName;
                txtAgentName.Text = contactInfo.AgentName;
                txtOfficeAddress.Text = contactInfo.OfficeAddress;
                txtFactoryAddress.Text = contactInfo.FactoryAddress;
                txtPhoneNo.Text = contactInfo.PhoneNo;
                txtFaxNo.Text = contactInfo.FaxNo;
                txtEmail.Text = contactInfo.EmailNo;
                txtContactPerson.Text = contactInfo.ContactPerson;
                txtTinNo.Text = contactInfo.TINNO;
                txtVATCode.Text = contactInfo.VATCode;
                ddlCostCentre.SelectedValue = contactInfo.CostCenterId.ToString();
                ddlBranch.SelectedValue = contactInfo.BranchID.ToString();
                if (contactInfo.ContactImage.IsNotNullOrEmpty())
                {
                    imgContactImage.ImageUrl = ResolveUrl(contactInfo.ContactImage);
                }
            }
            catch (Exception ex)
            {

                throw(ex);
            }
        }
Exemple #3
0
 public static CustomList<ContactInfo> GetAllSupplier()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ContactInfo> ContactInfoCollection = new CustomList<ContactInfo>();
     IDataReader reader = null;
     const String sql = "select ContactID,Name from Supplier";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ContactInfo newContactInfo = new ContactInfo();
             newContactInfo.SetDataSupplier(reader);
             ContactInfoCollection.Add(newContactInfo);
         };
         return ContactInfoCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }