Ejemplo n.º 1
0
        private void btn_assignPumper_Click(object sender, EventArgs e)
        {
            if (cmb_pumper.SelectedValue == null)
            {
                MessageBox.Show("Please select a Pumper from the list", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (lst_nozzels.SelectedItems.Count > 0)
            {
                DailyAssignWorkerDetails det = (DailyAssignWorkerDetails)lst_nozzels.SelectedItems[0].Tag;

                if (CustomeRepository.IsNozzelAssignedOn(det.DayID, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()), det.NozzelID) > 0)
                {
                    MessageBox.Show("You cannot assign a Pumper to this nozzel on this Session. Please select differant Session", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (MessageBox.Show("Do you want to Assign this pumper?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()) > 0)
                    {
                        string message = CustomeRepository.AssignPumperToNozzel(det.DayID, commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()), det.NozzelID, det.DayWorkerID, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()));
                        if (cmb_days.SelectedValue != null)
                        {
                            try
                            {
                                RefreshDailyAssignWorkerDetailList(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()));
                                MessageBox.Show(message, Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message, Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void CalculatePumpClosing()
        {
            if (lst_nozzels.SelectedItems.Count > 0)
            {
                DailyAssignWorkerDetails det = (DailyAssignWorkerDetails)lst_nozzels.SelectedItems[0].Tag;
                if (det != null)
                {
                    cmb_Nozzels.Text         = det.NozzelName;
                    num_starttotalizer.Value = det.LastTotalizerReading;
                    num_Price.Value          = det.UnitPrice;

                    decimal fuelqty        = num_EndTotalizer.Value - det.LastTotalizerReading;
                    decimal totalfuelvalue = fuelqty * det.UnitPrice;

                    num_Vriance.Value      = fuelqty;
                    num_totalFUelval.Value = totalfuelvalue;
                }
            }
            else
            {
                MessageBox.Show("Please Select a nozzel To close", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (num_workedHours.Value <= 0)
                {
                    MessageBox.Show("Working Hours must be grater than Zero", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (num_starttotalizer.Value >= num_EndTotalizer.Value)
                {
                    MessageBox.Show("Start totalizer value must grater than end totalizer value", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (num_starttotalizer.Value + 50 >= num_EndTotalizer.Value)
                {
                    MessageBox.Show("This pump's output value ( " + (num_EndTotalizer.Value - num_starttotalizer.Value).ToString() + " Liters ) is less than normal. ", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                int dayid    = commonFunctions.ToInt(cmb_days.SelectedValue.ToString());
                int pumperid = commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString());
                DailyAssignWorkerDetails det = (DailyAssignWorkerDetails)lst_nozzels.SelectedItems[0].Tag;
                if (det != null)
                {
                    if (!det.IsOpen)
                    {
                        MessageBox.Show("This nozzel already closed.", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (MessageBox.Show("Do you want to close this Nozzel?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CustomeRepository.InsetPumpClosing(
                            dayid,
                            det.PumperID,
                            det.NozzelID,
                            num_workedHours.Value,
                            num_starttotalizer.Value,
                            num_EndTotalizer.Value,
                            num_EndTotalizer.Value - num_starttotalizer.Value,
                            num_Price.Value,
                            (num_EndTotalizer.Value - num_starttotalizer.Value) * num_Price.Value,
                            det.SeqNo,
                            commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())
                            );

                        if (cmb_days.SelectedValue != null)
                        {
                            RefreshDailyAssignWorkerDetailList(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()));
                        }

                        lbl_pumpername.Text     = "(....)";
                        lbl_pumpername.Text     = "(....)";
                        pnl_indicator.BackColor = Color.Red;
                        lbl_nozzsrtatus.Text    = "Closed";
                    }
                }
                else
                {
                    MessageBox.Show("Please select a one nozzel from the list for closing", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found when loading data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        private void DoNozzelSelectedThings(ListViewItem item)
        {
            try
            {
                num_EndTotalizer.Enabled = true;
                DailyAssignWorkerDetails det = (DailyAssignWorkerDetails)item.Tag;
                PumpClosing close            = CustomeRepository.GetPumpClosingDetails(det.DayID, det.PumperID, true, det.NozzelID);

                cmb_pumper.SelectedValue = det.PumperID;
                lbl_selectedPumper.Text  = det.EmployeeName;

                if (close != null)
                {
                    if (close.IsProcessed)
                    {
                        num_EndTotalizer.Enabled = false;
                    }
                }

                if (det != null)
                {
                    cmb_Nozzels.Text         = det.NozzelName;
                    num_starttotalizer.Value = det.LastTotalizerReading;
                    num_EndTotalizer.Value   = det.LastTotalizerReading;
                    num_Price.Value          = det.UnitPrice;
                }

                if (item != null)
                {
                    string empname = "";

                    if (string.IsNullOrEmpty(det.EmployeeName))
                    {
                        empname = "Not Assigned";
                    }
                    else
                    {
                        empname = det.EmployeeName;

                        if (close != null)
                        {
                            num_EndTotalizer.Value = close.EndTotalizer;
                        }
                    }

                    if (det.IsOpen)
                    {
                        pnl_indicator.BackColor = Color.Green;
                        lbl_nozzsrtatus.Text    = "Assigned";
                        lbl_pumpername.Text     = empname;
                    }
                    else
                    {
                        pnl_indicator.BackColor = Color.Red;
                        lbl_nozzsrtatus.Text    = "Closed";
                        lbl_pumpername.Text     = "";
                    }
                    lbl_totalizer.Text  = det.LastTotalizerReading.ToString();
                    lbl_tank.Text       = det.TankName;
                    lbl_NozzelName.Text = det.NozzelName;
                    lbl_fueltype.Text   = det.FuelFullName;
                    lbl_unitprice.Text  = det.UnitPrice.ToString();
                }


                //update pump close status
            }
            catch (Exception ex)
            {
            }
        }