Beispiel #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            textCount.Text = Model.CheckIntVal(textCount.Text);
            textCena.Text  = Model.CheckIntVal(textCena.Text);
            string id_clothes = "0";

            if (comboBoxParent.SelectedIndex > 0 && comboBoxClothes.SelectedIndex > 0)
            {
                id_clothes = subRubCurentList[comboBoxClothes.SelectedIndex, 0];
            }
            if (itemId == 0)
            {
                if (ModelPrihodnayaNakladnayaIt.I().Insert(pId.ToString(), id_clothes, textName.Text, textCount.Text, textCena.Text))
                {
                    itemId = ModelPrihodnayaNakladnayaIt.I().GetLustId();
                    MessageBox.Show("Накладная успешно добавлена");
                }
                else
                {
                    MessageBox.Show("Произошла ошибка, попробуйте еще раз или обратитесь к админестратору");
                }
            }
            else
            {
                if (ModelPrihodnayaNakladnayaIt.I().Update(itemId.ToString(), pId.ToString(), id_clothes, textName.Text, textCount.Text, textCena.Text))
                {
                    MessageBox.Show("Накладная успешно изменена");
                }
                else
                {
                    MessageBox.Show("Произошла ошибка, попробуйте еще раз или обратитесь к админестратору");
                }
            }
            fParent.LoadValues();
        }
Beispiel #2
0
        public void LoadValues()
        {
            dataGridViewList.Rows.Clear();
            var item = ModelPrihodnayaNaklodnaya.I().GetItem(itemId);

            if (item != null)
            {
                textBoxNomer.Text = item.Nomer;
                DateTime date = DateTime.ParseExact(item.DateAdd, "dd'.'MM'.'yyyy h:mm:ss", CultureInfo.InvariantCulture);
                dateTimePickerCreateDate.Value = date;
                var items = ModelPrihodnayaNakladnayaIt.I().GetItems(this.itemId.ToString());
                if (items != null)
                {
                    foreach (var it in items.Values)
                    {
                        var rowNumber = dataGridViewList.Rows.Add();
                        dataGridViewList.Rows[rowNumber].Cells["id"].Value         = it.Id;
                        dataGridViewList.Rows[rowNumber].Cells["id_clothes"].Value = it.IdClothes;
                        dataGridViewList.Rows[rowNumber].Cells["group_name"].Value = it.GroupName;
                        dataGridViewList.Rows[rowNumber].Cells["name"].Value       = it.Name;
                        dataGridViewList.Rows[rowNumber].Cells["count"].Value      = it.Count;
                        dataGridViewList.Rows[rowNumber].Cells["price"].Value      = it.Price;
                    }
                }
                //ModelPrihodnayaNaklodnayaIt.I().GetById(item_id.ToString());
            }
        }
 public static ModelPrihodnayaNakladnayaIt I()
 {
     if (Instanse == null)
       {
     Instanse = new ModelPrihodnayaNakladnayaIt();
       }
       return Instanse;
 }
 public static ModelPrihodnayaNakladnayaIt I()
 {
     if (Instanse == null)
     {
         Instanse = new ModelPrihodnayaNakladnayaIt();
     }
     return(Instanse);
 }
Beispiel #5
0
 protected void LoadValues()
 {
     comboBoxParent.Items.Clear();
     rubList = ModelClothes.I().GetRubs();
     if (itemId != 0)
     {
         OleDbDataReader it = ModelPrihodnayaNakladnayaIt.I().GetById(itemId.ToString());
         if (it != null)
         {
             it.Read();
             textName.Text  = it["name"].ToString();
             textCount.Text = it["count"].ToString();
             textCena.Text  = it["price"].ToString();
             clothesId      = it["id_clothes"].ToString();
             LoadComboBoxValue(it["id_clothes"].ToString());
         }
     }
     else
     {
         LoadComboBoxValue("0");
     }
 }
Beispiel #6
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            Int32 selectedRowCount = dataGridViewList.SelectedRows.Count;

            if (selectedRowCount > 0)
            {
                var resault = MessageBox.Show(
                    "Вы уверенны что хотите удалить выбранные строки?",
                    "Подтверждение удаления",
                    MessageBoxButtons.YesNo
                    );
                if (resault == DialogResult.Yes)
                {
                    String delet_id_str = GetIdSetFromSelectedRows();

                    ModelPrihodnayaNakladnayaIt.I().DeleteByIdSet(delet_id_str);
                    LoadValues();
                }
            }
            else
            {
                MessageBox.Show("Выберите хотя бы одну строку");
            }
        }
 public void DeleteById(String id)
 {
     ModelPrihodnayaNakladnayaIt.I().DeleteWhere("id_naklad=" + id);
     DeleteWhere("id=" + id);
 }