Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of the Sol_AutoNumbers class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Sol_AutoNumber MakeSol_AutoNumber(SqlDataReader dataReader)
        {
            Sol_AutoNumber sol_AutoNumber = new Sol_AutoNumber();

            sol_AutoNumber.AgencyID    = SqlClientUtility.GetInt32(dataReader, "AgencyID", 0);
            sol_AutoNumber.FolioID     = SqlClientUtility.GetInt32(dataReader, "FolioID", 0);
            sol_AutoNumber.TagNumber   = SqlClientUtility.GetInt32(dataReader, "TagNumber", 0);
            sol_AutoNumber.RBillNumber = SqlClientUtility.GetInt32(dataReader, "RBillNumber", 0);

            return(sol_AutoNumber);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates a record in the Sol_AutoNumbers table.
        /// </summary>
        public virtual void Update(Sol_AutoNumber sol_AutoNumber)
        {
            ValidationUtility.ValidateArgument("sol_AutoNumber", sol_AutoNumber);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@AgencyID", sol_AutoNumber.AgencyID),
                new SqlParameter("@FolioID", sol_AutoNumber.FolioID),
                new SqlParameter("@TagNumber", sol_AutoNumber.TagNumber),
                new SqlParameter("@RBillNumber", sol_AutoNumber.RBillNumber)
            };

            SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "Sol_AutoNumbers_Update", parameters);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Selects all records from the Sol_AutoNumbers table.
        /// </summary>
        public virtual List <Sol_AutoNumber> SelectAll()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Sol_AutoNumbers_SelectAll"))
            {
                List <Sol_AutoNumber> sol_AutoNumberList = new List <Sol_AutoNumber>();
                while (dataReader.Read())
                {
                    Sol_AutoNumber sol_AutoNumber = MakeSol_AutoNumber(dataReader);
                    sol_AutoNumberList.Add(sol_AutoNumber);
                }

                return(sol_AutoNumberList);
            }
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
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();
        }