示例#1
0
        public override void Save()
        {
            string SQL = qryEmployeeSave;

            try
            {
                if (!Owner.isCreated)
                {
                    Owner = Program.UserContext;
                }
                SQL = SQL.Replace(":empid", Key.ToString());
                SQL = SQL.Replace(":persontitle", "'" + Title.ToString() + "'");
                SQL = SQL.Replace(":personname", "'" + Name.ToString() + "'");
                SQL = SQL.Replace(":personmiddle", "'" + Middlename.ToString() + "'");
                SQL = SQL.Replace(":personlastname", "'" + Surname.ToString() + "'");

                SQL = SQL.Replace(":_phone", Phone.ToString() == "" ? "null" : "'" + Phone.ToString() + "'");

                SQL = SQL.Replace(":city", "'" + City.ToString() + "'");
                SQL = SQL.Replace(":country", "'" + Country.ToString() + "'");
                SQL = SQL.Replace(":region", "'" + Region.ToString() + "'");
                SQL = SQL.Replace(":district", "'" + District.ToString() + "'");
                SQL = SQL.Replace(":_address", "'" + Address.ToString() + "'");
                SQL = SQL.Replace(":postalcode", "'" + PostalCode.ToString() + "'");

                SQL = SQL.Replace(":dateborn", "'" + Birthday.ToString() + "'");

                SQL = SQL.Replace(":_email", "'" + Email.ToString() + "'");

                SQL = SQL.Replace(":rcomment", "'" + RComment.ToString() + "'");
                SQL = SQL.Replace(":ownerid", isCreated ? Owner.Key : Program.UserContext.Key);

                SQL = SQL.Replace(":locked", Locked ? "1" : "0");
                SQL = SQL.Replace(":username", "'" + UserName.ToString() + "'");
                SQL = SQL.Replace(":userpassword", "'" + Encryption.Encode(UserPassword.ToString(), Program.PasswordKey) + "'");

                Client.ExecuteSQLCommit(SQL);

                Owner.Load();
                MainForm.toolStripStatusOwner.Text = Owner.Title;

                isChanged = false;
                isCreated = true;
                Program.EmployeesAreChanged = true;
                Program.RefreshEmployee(this);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\n");
            }
        }
示例#2
0
 public SqlParameter[] generateSqlParametersFromObjectFields()
 {
     return(new SqlParameter[] {
         new SqlParameter("CompanyId", CompanyId.ToString(), DbType.Int32),
         new SqlParameter("Name", Name, DbType.String),
         new SqlParameter("PIB", PIB, DbType.String),
         new SqlParameter("Address", Address, DbType.String),
         new SqlParameter("City", City, DbType.String),
         new SqlParameter("PostalCode", PostalCode.ToString(), DbType.Int32),
         new SqlParameter("Owner", Owner, DbType.String),
         new SqlParameter("BankAccount", BankAccount, DbType.String),
         new SqlParameter("IdentificationNumber", IdentificationNumber, DbType.String),
         new SqlParameter("Bank", Bank, DbType.String),
         new SqlParameter("ActivityCode", ActivityCode.ToString(), DbType.Int32),
         new SqlParameter("Telephone", Telephone, DbType.String),
         new SqlParameter("MobileNumber", MobileNumber, DbType.String),
         new SqlParameter("Email", Email, DbType.String),
         new SqlParameter("Fax", Fax, DbType.String)
     });
 }
示例#3
0
        public override void Save()
        {
            string SQL = qryCustomerSave;

            try
            {
                if (!Owner.isCreated)
                {
                    Owner = Program.UserContext;
                }
                SQL = SQL.Replace(":customerid", Key.ToString());
                SQL = SQL.Replace(":name", "'" + Name.ToString() + "'");

                SQL = SQL.Replace(":_phone", Phone.ToString() == "" ? "null" : "'" + Phone.ToString() + "'");

                SQL = SQL.Replace(":city", "'" + City.ToString() + "'");
                SQL = SQL.Replace(":country", "'" + Country.ToString() + "'");
                SQL = SQL.Replace(":region", "'" + Region.ToString() + "'");
                SQL = SQL.Replace(":district", "'" + District.ToString() + "'");
                SQL = SQL.Replace(":_address", "'" + Address.ToString() + "'");
                SQL = SQL.Replace(":postalcode", "'" + PostalCode.ToString() + "'");

                SQL = SQL.Replace(":_email", "'" + Email.ToString() + "'");
                SQL = SQL.Replace(":website", "'" + WebSite.ToString() + "'");

                SQL = SQL.Replace(":rcomment", "'" + RComment.ToString() + "'");
                SQL = SQL.Replace(":ownerid", isCreated ? Owner.Key : Program.UserContext.Key);

                Client.ExecuteSQLCommit(SQL);

                MainForm.toolStripStatusOwner.Text = Owner.Title;

                isChanged = false;
                isCreated = true;
                Program.CustomersAreChanged = true;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\n");
            }
        }
        public override string ToString()
        {
            var parts = new List <string>();

            if (Addressee != null &&
                !string.IsNullOrWhiteSpace(Addressee.ToString()))
            {
                parts.Add(Addressee.ToString());
            }
            if (StreetAddress != null &&
                !string.IsNullOrWhiteSpace(StreetAddress.ToString()))
            {
                parts.Add(StreetAddress.ToString());
            }
            if (Locality != null &&
                !string.IsNullOrWhiteSpace(Locality.ToString()))
            {
                parts.Add(Locality.ToString());
            }
            if (AdministrativeRegion != null &&
                !string.IsNullOrWhiteSpace(AdministrativeRegion.ToString()))
            {
                parts.Add(AdministrativeRegion.ToString());
            }
            if (PostalCode != null &&
                !string.IsNullOrWhiteSpace(PostalCode.ToString()))
            {
                parts.Add(PostalCode.ToString());
            }
            if (Country != null &&
                !string.IsNullOrWhiteSpace(Country.ToString()))
            {
                parts.Add(Country.ToString());
            }

            return(string.Join(", ", parts));
        }
 public override string ToString()
 {
     return(PickUpAgreementId.ToString() + "," + Vehicle.LicensePlate + "," + Vehicle.Brand + "," + Address + "," + PostalCode.ToString()
            + "," + City + "," + Driver.Name + "," + PickUpDate.ToString() + "," + PickUpTime + "," + Price.ToString() + "," + Vehicle.VehicleId.ToString());
 }
        public void FiveDigitPostalCode()
        {
            sut = PostalCode.Create(ValidPostalCode);

            Assert.AreEqual(ValidPostalCode, sut.ToString());
        }