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

            try
            {
                if (!Owner.isCreated)
                {
                    Owner = Program.UserContext;
                }
                SQL = SQL.Replace(":orderstateid_", Key.ToString());
                SQL = SQL.Replace(":name", "'" + Name.ToString() + "'");
                SQL = SQL.Replace(":code", "'" + Code.ToString() + "'");
                SQL = SQL.Replace(":statelevel", Level.ToString());
                SQL = SQL.Replace(":recindex", Index.ToString());
                SQL = SQL.Replace(":addorderstateid", Switchover == null ? "null" : Switchover.Key.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");
            }
        }
示例#2
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");
            }
        }
示例#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");
            }
        }