Example #1
0
 public void BindData(Contact contact)
 {
     this.contact = contact;
     this.lblImieNazwisko.Text = contact.FirstName + " " + contact.LastName;
     this.lblPhone.Text = "Tel: "+contact.Phone;
     this.lblEmail.Text = "Email: "+contact.Email;
 }
Example #2
0
 public FieldCall(Guid fieldcallid, Dictionary fieldcallstatus, Employee employee, Contact contact, CustomerFacility customerfacility)
 {
     this.fieldcallid= fieldcallid;
     this.fieldcallstatus= fieldcallstatus;
     this.employee= employee;
     this.contact= contact;
     this.customerfacility= customerfacility;
 }
Example #3
0
 public FieldCall(Guid fieldcallid, Dictionary fieldcallstatus, Employee employee, Contact contact, CustomerFacility customerfacility, string fulldescription, DateTime? date, DateTime? starttime, DateTime? endtime)
 {
     this.fieldcallid= fieldcallid;
     this.fieldcallstatus= fieldcallstatus;
     this.employee= employee;
     this.contact= contact;
     this.customerfacility= customerfacility;
     this.fulldescription= fulldescription;
     this.date= date;
     this.starttime= starttime;
     this.endtime= endtime;
 }
Example #4
0
        public static Contact InsertContact(Contact contact)
        {
            string sqlQuery = "INSERT INTO Contact(ContactID,FirstName,LastName,Email,Phone) " +
                " VALUES(@ContactID,@FirstName,@LastName,@Email,@Phone)";

            if (contact.ContactID == Guid.Empty)
                contact.ContactID = Guid.NewGuid();
            else
                return null;
            DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery);
            DBHelper.AddInParameter(dbCommand, "ContactID", DbType.Guid, contact.ContactID);
            DBHelper.AddInParameter(dbCommand, "FirstName", DbType.String, contact.FirstName);
            DBHelper.AddInParameter(dbCommand, "LastName", DbType.String, contact.LastName);
            DBHelper.AddInParameter(dbCommand, "Email", DbType.String, contact.Email);
            DBHelper.AddInParameter(dbCommand, "Phone", DbType.String, contact.Phone);
            return contact;
        }
Example #5
0
        private void btnZapisz_Click(object sender, EventArgs e)
        {
            if (employee != null)
            {
                try
                {
                    Contact contact = null;

                    if (employee.Contact == null)
                        contact = new Contact();
                    else
                        contact = employee.Contact;

                    contact.Email = txtEmail.Text;
                    contact.FirstName = txtImie.Text;
                    contact.LastName = txtNazwisko.Text;
                    contact.Phone = txtNrTelefonu.Text;

                    if (employee.Contact == null)
                    {
                        contact = ContactManager.InsertContact(contact);
                        employee.ContactID = contact.ContactID;
                    }
                    else
                        ContactManager.UpdateContact(contact);

                    if (employee.CreationDate == DateTime.MinValue)
                        employee.CreationDate = DateTime.Now;
                    if (employee.LastActivityDate == DateTime.MinValue)
                        employee.LastActivityDate = DateTime.Now;
                    if (employee.LastLoginDate == DateTime.MinValue)
                        employee.LastLoginDate = DateTime.Now;

                    EmployeeManager.UpdateEmployee(employee);
                    UIHelper.ShowInfo("Zmiany wprowadzone");
                }
                catch (Exception ex)
                {
                    UIHelper.ShowError("Błąd : " + ex.Message);
                }

            }
        }
Example #6
0
        public static void UpdateContact(Contact contact)
        {
            string sqlQuery = "UPDATE Contact SET FirstName=@FirstName,LastName=@LastName,Email=@Email,Phone=@Phone WHERE ContactID='" + contact.ContactID+"'";

            DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery);
            DBHelper.AddInParameter(dbCommand, "FirstName", DbType.String, contact.FirstName);
            DBHelper.AddInParameter(dbCommand, "LastName", DbType.String, contact.LastName);
            DBHelper.AddInParameter(dbCommand, "Email", DbType.String, contact.Email);
            DBHelper.AddInParameter(dbCommand, "Phone", DbType.String, contact.Phone);
            DBHelper.ExecuteNonQuery(dbCommand);
        }
Example #7
0
 private static Contact GetContactFromReader(IDataReader dataReader)
 {
     Contact contact = new Contact();
     contact.ContactID = DBHelper.GetGuid(dataReader, "ContactID");
     contact.FirstName = DBHelper.GetString(dataReader, "FirstName");
     contact.LastName = DBHelper.GetString(dataReader, "LastName");
     contact.Phone = DBHelper.GetString(dataReader, "Phone");
     contact.Email = DBHelper.GetString(dataReader, "Email");
     return contact;
 }
Example #8
0
 public static void UpdateContact(Contact contact)
 {
     ContactDB.UpdateContact(contact);
 }
Example #9
0
 public static Contact InsertContact(Contact contact)
 {
     return ContactDB.InsertContact(contact);
 }