コード例 #1
0
        protected void GrdDeliveryOrder_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteGrdDO")
            {
                BLL.DeliveryOrder DelDO = new BLL.DeliveryOrder();
                DeliveryOrderDetails DelDetails = new DeliveryOrderDetails();
                DelDO.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString()));
                DelDetails.getDetails(int.Parse(e.CommandArgument.ToString()));
                DelDetails.DeleteAll();
                DelDetails.Save();
                DelDO.MarkAsDeleted();
                DelDO.Save();

            }
            else if (e.CommandName == "EditGrdDO")
            {
                int ID = int.Parse(e.CommandArgument.ToString());

                Response.Redirect("DeliveryOrder.aspx?DeliveryOrderID=" + ID.ToString());

            }
            DeliveryOrderBind();
        }
コード例 #2
0
        protected void btnDeliceryOrderGrd_Click(object sender, EventArgs e)
        {
            BLL.DeliveryOrder DO = new BLL.DeliveryOrder();

            if (getQueryString_DeliveryOrder > 0)
            {
                DO.LoadByPrimaryKey(getQueryString_DeliveryOrder);
                btnDeliceryOrderGrd.Text = "تعديل أمر نقل";

            }
            else
            {
                DO.AddNew();

                btnDeliceryOrderGrd.Text = "أضافة أمر نقل";
                DO.CreatedBy = new Guid(Membership.GetUser().ProviderUserKey.ToString());
                DO.CreatedDate = DateTime.Now;
            }

            DO.ClientCode = int.Parse(txtClientCode.Text);
            DO.DeliveryOrderName = txtDeliveryOrderName.Text;
            DO.DepartmentID = int.Parse(drpDepartment.SelectedValue);
            if (txtPermission.Text != "")
            {
                DO.PermationNumber = int.Parse(txtPermission.Text);
            }
            else
                txtPermission.Text = "0";
            DO.TransformationSupplier = drpTransformationSupplier.SelectedItem.Value;
            DO.CarNumber = txtCarNumber.Text;
            if (txtKiloMeterBefore.Text != "")
            {
                DO.KilometerCounterBefore = decimal.Parse(txtKiloMeterBefore.Text);
            }
            else
                txtKiloMeterBefore.Text = "0.0";
            if (txtkiloMeterAfter.Text != "")
            {
                DO.KilometerCounterAfter = decimal.Parse(txtkiloMeterAfter.Text);
            }
            else
                txtkiloMeterAfter.Text = "0.0";
            DO.DriverName = txtDriverName.Text;
            DO.DriverNationID = txtDriverNationID.Text;
            DO.DriverTelephone = txtDriverTelephone.Text;
            DO.CarType = txtCarType.Text;
            //var eg = new CultureInfo("eg-EG");
            DO.DeliveryOrderDate = DateTime.ParseExact(txtDeliveryOrderDate.Text, "dd/MM/yyyy", null);
            DO.DepartmentResponsableName = txtDepartmentResponsable.Text;

            DO.GeneralDeliveryCode = txtGeneralDeliveryCode.Text;
            if (txtTotalPrice.Text != "")
            {
                DO.TotalPrice = double.Parse(txtTotalPrice.Text);
            }
            else
                txtTotalPrice.Text = "0.0";
            DO.DeliveryOrderStatusID = int.Parse(drpStatusGeneral.SelectedValue);
            DO.LastUpdatedDate = DateTime.Now;
            DO.UpdatedBy = new Guid(Membership.GetUser().ProviderUserKey.ToString());
            DO.Save();

            Response.Redirect("DeliveryOrder.aspx?DeliveryOrderID=" + DO.DeliveryOrderID.ToString());
            PanelDeliveryOrderDetails.Visible = true;
            WidEditDeliveryOrder.Visible = true;
            WidGrdGeneralDeliveryOrder.Visible = false;
            createNewDeliveryOrder.Visible = false;
        }