Esempio n. 1
0
        private void GetDeliveryScheduleByMonthandYear()
        {
            dbsched = new BusDeliverySchedule();

            int index = 0;

            dgvDeliverySchedule.Rows.Clear();

            if (dbsched.GetDeliveryScheduleByMonthandYearDT(tbPartCode.Text
                                                            , Convert.ToInt32(cboDeliverySchedMonth.SelectedValue.ToString())
                                                            , Convert.ToInt32(cboDeliverySchedYear.SelectedItem.ToString())
                                                            ).Rows.Count == 0)
            {
                MessageBox.Show("No Records Found");
            }
            else
            {
                foreach (DataRow dr in dbsched.GetDeliveryScheduleByMonthandYearDT(tbPartCode.Text
                                                                                   , Convert.ToInt32(cboDeliverySchedMonth.SelectedValue.ToString())
                                                                                   , Convert.ToInt32(cboDeliverySchedYear.SelectedItem.ToString())
                                                                                   ).Rows)
                {
                    dgvDeliverySchedule.Rows.Insert(index, dr["schedid"], dr["DeliveryDate"], dr["NameOfDay"], dr["DeliverySched_Qty"], dr["DeliverySched_Acc"]
                                                    , dr["ActDelivery_Qty"], dr["ActDelivery_Acc"], dr["DeliveryBal"]);
                    index++;
                }
            }
        }
Esempio n. 2
0
        private Boolean GenerateDeliverySchedule()
        {
            dbsched = new BusDeliverySchedule();

            if (dbsched.GetDeliveryScheduleByMonthandYearDT(tbPartCode.Text, Convert.ToInt32(cboDeliverySchedMonth.SelectedValue.ToString())
                                                            , Convert.ToInt32(cboDeliverySchedYear.SelectedItem.ToString())).Rows.Count == 0)
            {
                MessageBox.Show("All dates from this year has not been created. Dates must be created first.");

                return(false);
            }
            else
            {
                Boolean _validate = false;

                _validate = _ValidateDeliverySched();


                if (!_validate)
                {
                    return(false);
                }

                _sched = new BusDeliverySchedule();

                _sched.PartID = tbPartCode.Text;

                //_sched.DeliveryDate = Convert.ToDateTime(tbDateRequired.Text);

                _sched.DateMonth = Convert.ToInt32(cboDeliverySchedMonth.SelectedValue.ToString());

                _sched.DateYear = Convert.ToInt32(cboDeliverySchedYear.SelectedItem.ToString());

                _sched.RefreshedDeliverySchedule();


                foreach (DataRow dr in dbsched.GetDeliveryScheduleByMonthandYearDT(tbPartCode.Text
                                                                                   , Convert.ToInt32(cboDeliverySchedMonth.SelectedValue.ToString())
                                                                                   , Convert.ToInt32(cboDeliverySchedYear.SelectedItem.ToString())
                                                                                   ).Rows)
                {
                    _sched = new BusDeliverySchedule();

                    _sched.PartID = tbPartCode.Text;

                    _sched.DeliveryDate = Convert.ToDateTime(dr["DeliveryDate"].ToString());

                    _sched.UpdateDeliveryData();
                }

                //GetDeliveryScheduleByYear();

                GetDeliveryScheduleByMonthandYear();

                return(true);
            }
        }