예제 #1
0
 /// <summary>
 /// Creates a success response.
 /// </summary>
 /// <param name="salesobject">Saved salesobject.</param>
 /// <returns>Response.</returns>
 public SalesObjectResponse(SalesObject salesObject) : this(true, string.Empty, salesObject)
 {
 }
예제 #2
0
        private void btn_del_update_Click(object sender, EventArgs e)
        {
            DeliveryObject objdel  = new DeliveryObject();
            CustomerObject objcus  = new CustomerObject();
            SalesObject    objInv  = new SalesObject();
            EmployeeObject objemp  = new EmployeeObject();
            VehicalObject  objvehi = new VehicalObject();



            //chechk whether text feilds are empty or not
            if (txtb_del_deliveryno.Text == "" || txtb_del_invoiceid.Text == "" || txtb_del_cusid.Text == "" || txtb_del_driver.Text == "" || txtb_del_vehicalno.Text == "" || comb_del_status.Text == "" || rtxtb_del_description.Text == "" || txtb_del_from.Text == "" || txtb_del_to.Text == "" || txtb_del_distance.Text == "" || txtb_del_rate.Text == "" || txtb_del_cost.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                // objdel.DeliveryNo1 = txtb_del_deliveryno.Text;
                //  objInv.InvoiceID1 = Convert.ToInt32(txtb_del_invoiceid.Text);
                //  objcus.Nic = txtb_del_cusid.Text;
                objemp.empid        = Convert.ToInt32(txtb_del_driver.Text);
                objvehi.VehicalNo   = txtb_del_vehicalno.Text;
                objdel.Status1      = comb_del_status.Text;
                objdel.Description1 = rtxtb_del_description.Text;
                objdel.From1        = txtb_del_from.Text;
                objdel.To1          = txtb_del_to.Text;
                objdel.Distance1    = Convert.ToDouble(txtb_del_distance.Text);
                objdel.Rate1        = Convert.ToDouble(txtb_del_rate.Text);
                objdel.Cost1        = Convert.ToDouble(txtb_del_cost.Text);
                objdel.Date         = dtp_del_delDate.Value.Date;

                //show the confirmation dialog box
                DialogResult dr;
                dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                string Dr = dr.ToString();

                if (Dr == "Yes")
                {
                    try
                    {
                        MegaCoolMethods mcm    = new MegaCoolMethods();
                        bool            result = mcm.AddNewdelivery(objdel, objcus, objInv, objemp, objvehi);


                        if (result)
                        {
                            MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            // FillMemberDetails();
                        }
                        else
                        {
                            MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    catch (ApplicationException appEx)
                    {
                        MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    catch (SqlException ex)
                    {
                        if (ex.Number == 2627)
                        {
                            MessageBox.Show("This Delivery Number is already Exsists");
                        }
                    }

                    rbtn_del_delivery.Checked = true;
                    deliveryDELIVERYFillGrid();
                    deliveryProcessingDELIVERYFillGrid();
                    //else
                    //    MessageBox.Show("Data is not entered");

                    //deliveryFillGrid();
                    //vehi_clear();
                }
                //}
            }
        }
예제 #3
0
 public SalesObjectResponse(bool success, string message, SalesObject salesObject) : base(success, message)
 {
     SalesObject = salesObject;
 }