private void LoadContact() { if (_mode != "AddClone") { BusinessLayer.Contact objContact = new BusinessLayer.Contact(); objContact.ContactType = 5; objContact.RefID = _deptid; if (_deptid <= 0) objContact.RefID = intRandomNo; DataTable dtbl = objContact.LoadData("DepartmentContact"); grdContact.DataSource = (DataTable)dtbl; } }
public void LoadData() { string revQuery = "Select CompanyName = CASE " + "WHEN NickName IS NULL THEN [CompanyName] " + "WHEN NickName = '' THEN [CompanyName] " + "ELSE NickName " + "END From " + "Contact Where ContactType=2 and " + "ContactStatus=1 Order By CompanyName"; IDataReader reader = DAC.SelectStatement(revQuery); if (_mode == "Add") { while(reader.Read()) { if (reader["CompanyName"] != DBNull.Value) { cmbClient.Items.Remove(reader["CompanyName"].ToString()); } } cmbClient.Text = String.Empty; cmbClient.Tag = String.Empty; cmbStatus.SelectedIndex = 0; txtCompName.Text = String.Empty; txtCompName.Tag = String.Empty; chkNoDept.Checked = false; txtCompPhonetic.Text = String.Empty; txtCompRomaji.Text = String.Empty; txtNickName.Text = String.Empty; txtNickName.Tag = String.Empty; txtAccLName.Text = String.Empty; txtAccLPhonetic.Text = String.Empty; txtAccLRomaji1.Text = String.Empty; txtAccFirstName.Text = String.Empty; txtAccFirstPhonetic.Text = String.Empty; txtAccFirstRomaji.Text = String.Empty; cmbBlock.Text = String.Empty; txtStreet1.Text = String.Empty; txtStreet2.Text = String.Empty; txtStreet3.Text = String.Empty; txtCity.Text = String.Empty; txtState.Text = String.Empty; txtPost.Text = String.Empty; txtCountry.Text = String.Empty; txtPhone1.Text = String.Empty; txtPhone2.Text = String.Empty; txtFax1.Text = String.Empty; txtFax2.Text = String.Empty; txtPhoneOther.Text = String.Empty; txtUrl.Text = String.Empty; dtJoined.Value = dtEnded.Value = DateTime.Now; dtJoined.Checked = true; dtEnded.Checked = true; txtMintSt1.Text = String.Empty; txtClosestSt1.Text = String.Empty; txtClosestLine1.Text = String.Empty; txtMintSt2.Text = String.Empty; txtClosestSt2.Text = String.Empty; txtClosestLine2.Text = String.Empty; cmbStatus.SelectedIndex = 0; } else { //Calling the Dept. class file int intClientID=0; int intStatus=0; Department objDept=new Department(); objDept.DeptID = _deptid; objDept.LoadData(); //read the values intClientID = objDept.ClientID; intContactID = objDept.ContactID; cmbClient.Text = objDept.ClientName; while (reader.Read()) { if (reader["CompanyName"] != DBNull.Value && reader["CompanyName"].ToString() != objDept.ClientName) { cmbClient.Items.Remove(reader["CompanyName"].ToString()); } } cmbClient.Tag = objDept.ClientName; intStatus = objDept.StatusID; cmbStatus.SelectedIndex=intStatus; //Getting data from Contact Table Contact objContact=new Contact(); objContact.ContactID = _contactid; objContact.LoadData("Department"); foreach(DataRow dr in objContact.dtblContacts.Rows) { txtCompName.Text = dr["CompanyName"].ToString(); txtCompName.Tag = dr["CompanyName"].ToString(); if (txtCompName.Text == "No Department") chkNoDept.Checked = true; else if (_mode == "AddClone") txtCompName.Text = "Copy of " + txtCompName.Text; txtCompPhonetic.Text = dr["CompanyNamePhonetic"].ToString(); txtCompRomaji.Text = dr["CompanyNameRomaji"].ToString(); txtNickName.Text = dr["NickName"].ToString(); txtNickName.Tag = txtNickName.Text; txtAccLName.Text = dr["AccountRepLastName"].ToString(); txtAccLPhonetic.Text = dr["AccountRepLastNamePhonetic"].ToString(); txtAccLRomaji1.Text = dr["AccountRepLastNameRomaji"].ToString(); txtAccFirstName.Text = dr["AccountRepFirstName"].ToString(); txtAccFirstPhonetic.Text = dr["AccountRepFirstNamePhonetic"].ToString(); txtAccFirstRomaji.Text = dr["AccountRepFirstNameRomaji"].ToString(); if(dr["BlockCode"].ToString().Trim()!="") { cmbBlock.Text = dr["BlockCode"].ToString(); } txtStreet1.Text = dr["Street1"].ToString(); txtStreet2.Text = dr["Street2"].ToString(); txtStreet3.Text = dr["Street3"].ToString(); txtCity.Text = dr["City"].ToString(); txtState.Text = dr["State"].ToString(); txtPost.Text = dr["PostalCode"].ToString(); txtCountry.Text = dr["Country"].ToString(); txtPhone1.Text = dr["Phone1"].ToString(); txtPhone2.Text = dr["Phone2"].ToString(); txtFax1.Text = dr["PhoneFax1"].ToString(); txtFax2.Text = dr["PhoneFax2"].ToString(); txtPhoneOther.Text = dr["PhoneOther"].ToString(); txtUrl.Text = dr["url"].ToString(); if(dr["DateJoined"]!=DBNull.Value) { dtJoined.Value = Convert.ToDateTime(dr["DateJoined"].ToString()); dtJoined.Checked = true; } else { dtJoined.Checked=false; } if(dr["DateEnded"]!=DBNull.Value) { dtEnded.Value = Convert.ToDateTime(dr["DateEnded"].ToString()); dtEnded.Checked = true; } else { dtEnded.Checked=false; } txtMintSt1.Text = dr["MinutesToStation1"].ToString(); txtClosestSt1.Text = dr["ClosestStation1"].ToString(); txtClosestLine1.Text = dr["Closestline1"].ToString(); txtMintSt2.Text = dr["MinutesToStation2"].ToString(); txtClosestSt2.Text = dr["ClosestStation2"].ToString(); txtClosestLine2.Text = dr["Closestline2"].ToString(); cmbStatus.SelectedIndex = Convert.ToInt16(dr["ContactStatus"].ToString()); } if(chkNoDept.Checked) txtCompName.Text = "No Department"; LoadContact(); } }
public void LoadData() { if (_mode == "Edit" || _mode=="AddClone") { if (_mode == "AddClone") { btnDelete.Enabled = false; Text = "Adding User Clone..."; } else { btnDelete.Enabled = true; Text = "Editing User..."; } User objUser = new User(); objUser.UserID = _userid; objUser.LoadData(); if (_mode == "Edit") { txtUserName.Text = objUser.Name; txtUserName.Tag = objUser.Name; txtPwd.Text = objUser.Pwd; txtPwd.Tag = objUser.Pwd; } else { txtUserName.Text = "Copy of " + objUser.Name; } cmbType.SelectedIndex = objUser.TypeID; //cmbStatus.SelectedIndex = objUser.StatusID; //Getting Contact details from Contact Table Contact objContact = new Contact(); objContact.ContactID = _contactid; objContact.LoadData("User"); foreach (DataRow dr in objContact.dtblContacts.Rows) { //cmbType.SelectedIndex = Convert.ToInt16(dr["ContactType"].ToString()); txtLName.Text = dr["LastName"].ToString(); txtLNamePhonetic.Text = dr["LastNamePhonetic"].ToString(); txtLNameRomaji.Text = dr["LastNameRomaji"].ToString(); txtFName.Text = dr["FirstName"].ToString(); txtFNamePhonetic.Text = dr["FirstNamePhonetic"].ToString(); txtFNameRomaji.Text = dr["FirstNameRomaji"].ToString(); txtCompName.Text = dr["CompanyName"].ToString(); txtCompPhonetic.Text = dr["CompanyNamePhonetic"].ToString(); txtCompRomaji.Text = dr["CompanyNameRomaji"].ToString(); cmbTitle.Text = dr["TitleForname"].ToString(); txtTitleJob.Text = dr["TitleForJob"].ToString(); if (dr["BlockCode"].ToString().Trim() != "") cmbBlock.Text = dr["BlockCode"].ToString(); txtStreet1.Text = dr["Street1"].ToString(); txtStreet2.Text = dr["Street2"].ToString(); txtStreet3.Text = dr["Street3"].ToString(); txtCity.Text = dr["City"].ToString(); txtState.Text = dr["State"].ToString(); txtPost.Text = dr["PostalCode"].ToString(); txtCountry.Text = dr["Country"].ToString(); txtEmail1.Text = dr["Email1"].ToString(); txtEmail2.Text = dr["EMail2"].ToString(); txtPhone1.Text = dr["Phone1"].ToString(); txtPhone2.Text = dr["Phone2"].ToString(); txtMobile1.Text = dr["PhoneMobile1"].ToString(); txtMobile2.Text = dr["PhoneMobile2"].ToString(); txtPhone3.Text = dr["PhoneBusiness1"].ToString(); txtPhone4.Text = dr["PhoneBusiness2"].ToString(); txtFax1.Text = dr["PhoneFax1"].ToString(); txtFax2.Text = dr["PhoneFax2"].ToString(); txtPhoneOther.Text = dr["PhoneOther"].ToString(); txtUrl.Text = dr["url"].ToString(); if (dr["DateBirth"] != DBNull.Value) dtDOB.Value = Convert.ToDateTime(dr["DateBirth"].ToString()); else dtDOB.Checked = false; if (dr["DateJoined"] != DBNull.Value) dtJoined.Value = Convert.ToDateTime(dr["DateJoined"].ToString()); else dtJoined.Checked = false; if (dr["DateEnded"] != DBNull.Value) dtEnded.Value = Convert.ToDateTime(dr["DateEnded"].ToString()); else dtEnded.Checked = false; txtNationality.Text = dr["Nationality"].ToString(); cmbMarried.SelectedIndex = Convert.ToInt16(dr["Married"].ToString()); txtNoDependent.Text = dr["NumberDependents"].ToString(); txtVisaStatus.Text = dr["VisaStatus"].ToString(); if (dr["VisaFromDate"] != DBNull.Value) dtVisaFrom.Value = Convert.ToDateTime(dr["VisaFromDate"].ToString()); else dtVisaFrom.Checked = false; if (dr["VisaUntilDate"] != DBNull.Value) dtVisaTo.Value = Convert.ToDateTime(dr["VisaUntilDate"].ToString()); else dtVisaTo.Checked = false; txtMintSt1.Text = dr["MinutesToStation1"].ToString(); txtClosestSt1.Text = dr["ClosestStation1"].ToString(); txtClosestLine1.Text = dr["Closestline1"].ToString(); txtMintSt2.Text = dr["MinutesToStation2"].ToString(); txtClosestSt2.Text = dr["ClosestStation2"].ToString(); txtClosestLine2.Text = dr["Closestline2"].ToString(); cmbEmpStatus.Text = dr["TimeStatus"].ToString(); cmbStatus.Text = dr["Status"].ToString(); } } else { btnDelete.Enabled = false; Text = "Adding User..."; cmbType.SelectedIndex = 0; cmbStatus.SelectedIndex = 0; txtUserName.Text = String.Empty; txtUserName.Tag = String.Empty; txtPwd.Text = String.Empty; txtPwd.Tag = String.Empty; txtLName.Text = String.Empty; txtLNamePhonetic.Text = String.Empty; txtLNameRomaji.Text = String.Empty; txtFName.Text = String.Empty; txtFNamePhonetic.Text = String.Empty; txtFNameRomaji.Text = String.Empty; txtCompName.Text = String.Empty; txtCompPhonetic.Text = String.Empty; txtCompRomaji.Text = String.Empty; cmbTitle.Text = String.Empty; txtTitleJob.Text = String.Empty; cmbBlock.Text = String.Empty; txtStreet1.Text = String.Empty; txtStreet2.Text = String.Empty; txtStreet3.Text = String.Empty; txtCity.Text = String.Empty; txtState.Text = String.Empty; txtPost.Text = String.Empty; txtCountry.Text = String.Empty; txtEmail1.Text = String.Empty; txtEmail2.Text = String.Empty; txtPhone1.Text = String.Empty; txtPhone2.Text = String.Empty; txtMobile1.Text = String.Empty; txtMobile2.Text = String.Empty; txtPhone3.Text = String.Empty; txtPhone4.Text = String.Empty; txtFax1.Text = String.Empty; txtFax2.Text = String.Empty; txtPhoneOther.Text = String.Empty; txtUrl.Text = String.Empty; dtDOB.Checked = false; dtJoined.Checked = false; dtEnded.Checked = false; txtNationality.Text = String.Empty; cmbMarried.SelectedIndex = 0; txtNoDependent.Text = String.Empty; txtVisaStatus.Text = String.Empty; dtVisaFrom.Checked = false; dtVisaTo.Checked = false; txtMintSt1.Text = String.Empty; txtClosestSt1.Text = String.Empty; txtClosestLine1.Text = String.Empty; txtMintSt2.Text = String.Empty; txtClosestSt2.Text = String.Empty; txtClosestLine2.Text = String.Empty; cmbEmpStatus.Text = String.Empty; cmbStatus.Text = String.Empty; } }
public void LoadData() { if (_mode == "Edit" || _mode == "AddClone") { if (_mode == "Edit") { btnDelete.Enabled = true; this.Text = "Editing Client..."; } else { btnDelete.Enabled = false; this.Text = "Adding Client Clone..."; } Scheduler.BusinessLayer.Contact objContact=new Scheduler.BusinessLayer.Contact(); objContact.ContactID = _contactid; objContact.LoadData("Contact"); foreach(DataRow dr in objContact.dtblContacts.Rows) { txtCompName.Text = dr["CompanyName"].ToString(); txtCompName.Tag = txtCompName.Text; if (_mode == "AddClone") txtCompName.Text = "Copy of " + txtCompName.Text; txtCompPhonetic.Text = dr["CompanyNamePhonetic"].ToString(); txtCompRomaji.Text = dr["CompanyNameRomaji"].ToString(); txtNickName.Text = dr["NickName"].ToString(); txtNickName.Tag = txtNickName.Text; txtAccLName.Text = dr["AccountRepLastName"].ToString(); txtAccLPhonetic.Text = dr["AccountRepLastNamePhonetic"].ToString(); txtAccLRomaji1.Text = dr["AccountRepLastNameRomaji"].ToString(); txtAccFirstName.Text = dr["AccountRepFirstName"].ToString(); txtAccFirstPhonetic.Text = dr["AccountRepFirstNamePhonetic"].ToString(); txtAccFirstRomaji.Text = dr["AccountRepFirstNameRomaji"].ToString(); if(dr["BlockCode"].ToString().Trim()!="") { cmbBlock.Text = dr["BlockCode"].ToString(); } txtStreet1.Text = dr["Street1"].ToString(); txtStreet2.Text = dr["Street2"].ToString(); txtStreet3.Text = dr["Street3"].ToString(); txtCity.Text = dr["City"].ToString(); txtState.Text = dr["State"].ToString(); txtPost.Text = dr["PostalCode"].ToString(); txtCountry.Text = dr["Country"].ToString(); txtPhone1.Text = dr["Phone1"].ToString(); txtPhone2.Text = dr["Phone2"].ToString(); txtFax1.Text = dr["PhoneFax1"].ToString(); txtFax2.Text = dr["PhoneFax2"].ToString(); txtPhoneOther.Text = dr["PhoneOther"].ToString(); txtUrl.Text = dr["url"].ToString(); if(dr["DateJoined"]!=System.DBNull.Value) { dtJoined.Value = Convert.ToDateTime(dr["DateJoined"].ToString()); dtJoined.Checked = true; } else { dtJoined.Checked=false; } if(dr["DateEnded"]!=System.DBNull.Value) { dtEnded.Value = Convert.ToDateTime(dr["DateEnded"].ToString()); dtEnded.Checked = true; } else { dtEnded.Checked=false; } txtMintSt1.Text = dr["MinutesToStation1"].ToString(); txtClosestSt1.Text = dr["ClosestStation1"].ToString(); txtClosestLine1.Text = dr["Closestline1"].ToString(); txtMintSt2.Text = dr["MinutesToStation2"].ToString(); txtClosestSt2.Text = dr["ClosestStation2"].ToString(); txtClosestLine2.Text = dr["Closestline2"].ToString(); cmbStatus.SelectedIndex = Convert.ToInt16(dr["ContactStatus"].ToString()); } } else { btnDelete.Enabled=true; this.Text = "Adding Client..."; txtCompName.Text = String.Empty; txtCompName.Tag = String.Empty; txtCompPhonetic.Text = String.Empty; txtCompRomaji.Text = String.Empty; txtNickName.Text = String.Empty; txtNickName.Tag = String.Empty; txtAccLName.Text = String.Empty; txtAccLPhonetic.Text = String.Empty; txtAccLRomaji1.Text = String.Empty; txtAccFirstName.Text = String.Empty; txtAccFirstPhonetic.Text = String.Empty; txtAccFirstRomaji.Text = String.Empty; cmbBlock.Text = String.Empty; txtStreet1.Text = String.Empty; txtStreet2.Text = String.Empty; txtStreet3.Text = String.Empty; txtCity.Text = String.Empty; txtState.Text = String.Empty; txtPost.Text = String.Empty; txtCountry.Text = String.Empty; txtPhone1.Text = String.Empty; txtPhone2.Text = String.Empty; txtFax1.Text = String.Empty; txtFax2.Text = String.Empty; txtPhoneOther.Text = String.Empty; txtUrl.Text = String.Empty; dtJoined.Checked = dtEnded.Checked = true; dtJoined.Value = dtEnded.Value = DateTime.Now; txtMintSt1.Text = String.Empty; txtClosestSt1.Text = String.Empty; txtClosestLine1.Text = String.Empty; txtMintSt2.Text = String.Empty; txtClosestSt2.Text = String.Empty; txtClosestLine2.Text = String.Empty; cmbStatus.SelectedIndex = 0; } LoadContact(); }
public void LoadData() { if(_mode=="Edit" || _mode=="AddClone") { if (_mode == "Edit") this.Text = "Editing Course..."; else this.Text = "Adding Contact Clone..."; Scheduler.BusinessLayer.Contact objContact=new Scheduler.BusinessLayer.Contact(); objContact.ContactID = _contactid; objContact.LoadData("Contact"); foreach(DataRow dr in objContact.dtblContacts.Rows) { cmbType.SelectedIndex = Convert.ToInt16(dr["ContactType"].ToString()); txtLName.Text = dr["LastName"].ToString(); txtLNamePhonetic.Text = dr["LastNamePhonetic"].ToString(); txtLNameRomaji.Text = dr["LastNameRomaji"].ToString(); txtFName.Text = dr["FirstName"].ToString(); if (_mode == "AddClone") txtFName.Text = "Copy of " + txtFName.Text; txtFNamePhonetic.Text = dr["FirstNamePhonetic"].ToString(); txtFNameRomaji.Text = dr["FirstNameRomaji"].ToString(); txtCompName.Text = dr["CompanyName"].ToString(); txtCompPhonetic.Text = dr["CompanyNamePhonetic"].ToString(); txtCompRomaji.Text = dr["CompanyNameRomaji"].ToString(); txtContactName1.Text = dr["ContactlastName1"].ToString(); txtContactPhonetic1.Text = dr["ContactlastNamePhonetic1"].ToString(); txtContactRomaji1.Text = dr["ContactLastNameRomaji1"].ToString(); txtContactName2.Text = dr["ContactLastName2"].ToString(); txtContactPhonetic2.Text = dr["ContactLastNamePhonetic2"].ToString(); txtContactRomaji2.Text = dr["ContactLastNameRomaji2"].ToString(); txtAccLName.Text = dr["AccountRepLastName"].ToString(); txtAccLPhonetic.Text = dr["AccountRepLastNamePhonetic"].ToString(); txtAccLRomaji1.Text = dr["AccountRepLastNameRomaji"].ToString(); txtAccFirstName.Text = dr["AccountRepFirstName"].ToString(); txtAccFirstPhonetic.Text = dr["AccountRepFirstNamePhonetic"].ToString(); txtAccFirstRomaji.Text = dr["AccountRepFirstNameRomaji"].ToString(); cmbTitle.Text = dr["TitleForname"].ToString(); txtTitleJob.Text = dr["TitleForJob"].ToString(); if(dr["BlockCode"].ToString().Trim()!="") { cmbBlock.Text = dr["BlockCode"].ToString(); } txtStreet1.Text = dr["Street1"].ToString(); txtStreet2.Text = dr["Street2"].ToString(); txtStreet3.Text = dr["Street3"].ToString(); txtCity.Text = dr["City"].ToString(); txtState.Text = dr["State"].ToString(); txtPost.Text = dr["PostalCode"].ToString(); txtCountry.Text = dr["Country"].ToString(); txtEmail1.Text = dr["Email1"].ToString(); txtEmail2.Text = dr["EMail2"].ToString(); txtPhone1.Text = dr["Phone1"].ToString(); txtPhone2.Text = dr["Phone2"].ToString(); txtMobile1.Text = dr["PhoneMobile1"].ToString(); txtMobile2.Text = dr["PhoneMobile2"].ToString(); txtPhone3.Text = dr["PhoneBusiness1"].ToString(); txtPhone4.Text = dr["PhoneBusiness2"].ToString(); txtFax1.Text = dr["PhoneFax1"].ToString(); txtFax2.Text = dr["PhoneFax2"].ToString(); txtPhoneOther.Text = dr["PhoneOther"].ToString(); txtUrl.Text = dr["url"].ToString(); if(dr["DateBirth"]!=System.DBNull.Value) dtDOB.Value = Convert.ToDateTime(dr["DateBirth"].ToString()); else dtDOB.Checked=false; if(dr["DateJoined"]!=System.DBNull.Value) dtJoined.Value = Convert.ToDateTime(dr["DateJoined"].ToString()); else dtJoined.Checked=false; if(dr["DateEnded"]!=System.DBNull.Value) dtEnded.Value = Convert.ToDateTime(dr["DateEnded"].ToString()); else dtEnded.Checked=false; txtNationality.Text = dr["Nationality"].ToString(); cmbMarried.SelectedIndex = Convert.ToInt16(dr["Married"].ToString()); txtNoDependent.Text = dr["NumberDependents"].ToString(); txtVisaStatus.Text = dr["VisaStatus"].ToString(); if(dr["VisaFromDate"]!=System.DBNull.Value) dtVisaFrom.Value = Convert.ToDateTime(dr["VisaFromDate"].ToString()); else dtVisaFrom.Checked=false; if(dr["VisaUntilDate"]!=System.DBNull.Value) dtVisaTo.Value = Convert.ToDateTime(dr["VisaUntilDate"].ToString()); else dtVisaTo.Checked=false; txtMintSt1.Text = dr["MinutesToStation1"].ToString(); txtClosestSt1.Text = dr["ClosestStation1"].ToString(); txtClosestLine1.Text = dr["Closestline1"].ToString(); txtMintSt2.Text = dr["MinutesToStation2"].ToString(); txtClosestSt2.Text = dr["ClosestStation2"].ToString(); txtClosestLine2.Text = dr["Closestline2"].ToString(); cmbStatus.SelectedIndex = Convert.ToInt16(dr["ContactStatus"].ToString()); } } else { this.Text = "Adding Contact..."; } }
private void LoadData() { BusinessLayer.Contact objContact=new BusinessLayer.Contact(); objContact.ContactID=_id; objContact.RefID=0; DataTable dtbl = objContact.LoadData(_contacttype); foreach(DataRow dr in dtbl.Rows) { txtFName.Text = dr["FirstName"].ToString(); txtFNamePhonetic.Text = dr["FirstNamePhonetic"].ToString(); txtFNameRomaji.Text = dr["FirstNameRomaji"].ToString(); txtLName.Text = dr["LastName"].ToString(); txtLNamePhonetic.Text = dr["LastNamePhonetic"].ToString(); txtLNameRomaji.Text = dr["LastNameRomaji"].ToString(); txtFax.Text = dr["PhoneFax1"].ToString(); txtFName.Tag = txtFName.Text; txtLName.Tag = txtLName.Text; txtEmail.Text = dr["Email1"].ToString(); txtPhone.Text = dr["Phone1"].ToString(); txtMobile.Text = dr["PhoneMobile1"].ToString(); if(dr["ContactStatus"]==null)cmbStatus.SelectedIndex=0; cmbStatus.SelectedIndex = Convert.ToInt16(dr["ContactStatus"].ToString()); break; } }