コード例 #1
0
        private bool RestoreTagNumber()
        {
            int id = sol_Agency.AgencyID;

            if (id < 1)
            {
                return(false);
            }

            if (sol_AutoNumber_Sp == null)
            {
                sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            Sol_AutoNumber sol_AutoNumber = sol_AutoNumber_Sp.Select(id, 1);
            int            tagNumber      = 0;

            int.TryParse(sol_Stage.TagNumber, out tagNumber);
            if (sol_AutoNumber.TagNumber == tagNumber)
            {
                sol_AutoNumber.TagNumber--;
                sol_AutoNumber_Sp.Update(sol_AutoNumber);
            }

            return(true);
        }
コード例 #2
0
        private void ReadAutoGeneratedNumbers()
        {
            intValue = 0;
            int.TryParse(agencyIDTextBox.Text, out intValue);

            sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_AutoNumber    = sol_AutoNumber_Sp.Select(intValue, 1);
            if (sol_AutoNumber == null)
            {
                sol_AutoNumber             = new Sol_AutoNumber();
                sol_AutoNumber.AgencyID    = intValue;
                sol_AutoNumber.FolioID     = 1;
                sol_AutoNumber.TagNumber   = 0;
                sol_AutoNumber.RBillNumber = 0;
                sol_AutoNumber_Sp.Insert(sol_AutoNumber);
            }

            //checkBoxAutoTagNumber.Checked = Main.Sol_ControlInfo.AutoGenerateTagNumber;
            textBoxTagNumber.Text = sol_AutoNumber.TagNumber.ToString();

            //checkBoxAutoRBillNumber.Checked = Main.Sol_ControlInfo.AutoGenerateRBillNumber;
            textBoxRBillNumber.Text = sol_AutoNumber.RBillNumber.ToString();
        }
コード例 #3
0
        //find out which control has focus
        //protected Control GetFocusControl()
        //{
        //    Control focusControl = null;
        //    IntPtr focusHandle = GetFocus();
        //    if (focusHandle != IntPtr.Zero)
        //        // returns null if handle is not to a .NET control
        //        focusControl = Control.FromHandle(focusHandle);
        //    return focusControl;
        //}


        private bool AutoGenerateTagNumber()
        {
            int id = sol_Agency.AgencyID;

            if (id < 1)
            {
                return(false);
            }

            if (sol_AutoNumber_Sp == null)
            {
                sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            id = sol_AutoNumber_Sp.UpdateTagNumber(id, 1);
            if (id < 1)
            {
                MessageBox.Show("Can not generate next Tag number, last Tag number should be a valid integer.");
                return(false);
            }
            textBoxTagNumber.Text = id.ToString();

            return(true);
        }
コード例 #4
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (b_Add)
            {
                if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolAddCatalogues", true))
                {
                    return;
                }
            }
            else
            {
                if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolEditCatalogues", true))
                {
                    return;
                }
            }

            //bool flag = panelDetails.Visible;

            /*if (flag)
             * {
             *  if (!ValidateForm())
             *      return;
             *
             *  cambiarVista();
             * }*/

            ////hay cambios?
            //if (dataSetProducts.HasChanges())
            //{
            this.Validate();
            this.sol_AgenciesBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dataSetAgencies);
            try
            {
                //if (Convert.ToInt32(productIDTextBox.Text) < 0)
                if (b_Add)
                {
                    b_Add = false;
                    this.sol_AgenciesTableAdapter.Fill(this.dataSetAgencies.sol_Agencies);
                    this.sol_AgenciesBindingSource.MoveLast();
                }
                else
                {
                    intValue = 0;
                    int.TryParse(agencyIDTextBox.Text, out intValue);
                    if (sol_AutoNumber_Sp == null)
                    {
                        sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString);
                    }

                    if (sol_AutoNumber == null)
                    {
                        sol_AutoNumber             = new Sol_AutoNumber();
                        sol_AutoNumber.AgencyID    = intValue;
                        sol_AutoNumber.FolioID     = 1;
                        sol_AutoNumber.TagNumber   = 0;
                        sol_AutoNumber.RBillNumber = 0;
                        sol_AutoNumber_Sp.Insert(sol_AutoNumber);
                    }

                    intValue = 0;
                    int.TryParse(textBoxTagNumber.Text, out intValue);
                    sol_AutoNumber.TagNumber = intValue;

                    intValue = 0;
                    int.TryParse(textBoxRBillNumber.Text, out intValue);
                    sol_AutoNumber.RBillNumber = intValue;

                    sol_AutoNumber_Sp.Update(sol_AutoNumber);

                    //Main.Sol_ControlInfo.AutoGenerateTagNumber = checkBoxAutoTagNumber.Checked;
                    //Main.Sol_ControlInfo.AutoGenerateRBillNumber = checkBoxAutoRBillNumber.Checked;
                }
            }
            catch
            {
                //
            }

            //}
            //if (!flag)
            Close();
        }