public void bindData()
 {
     TransformationSupplier suppliers = new TransformationSupplier();
     suppliers.LoadAll();
     GridViewSuppliers.DataSource = suppliers.DefaultView;
     GridViewSuppliers.DataBind();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.TransformationSupplier DOO = new BLL.TransformationSupplier();
            DOO.LoadAll();
            drpTransformationSupplier.DataSource = DOO.DefaultView;
            drpTransformationSupplier.DataValueField = TransformationSupplier.ColumnNames.TransformationSupplierID;
            drpTransformationSupplier.DataTextField = TransformationSupplier.ColumnNames.TransformationSupplierName;
            drpTransformationSupplier.DataBind();

            DeliveryOrderStatus Ds = new DeliveryOrderStatus();
            Ds.LoadAll();
            drpDeliveryOrderStatus.DataSource = Ds.DefaultView;
            drpDeliveryOrderStatus.DataValueField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusID;
            drpDeliveryOrderStatus.DataTextField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusNameAr;
            drpDeliveryOrderStatus.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "اوامر تشغيل السيارات";

                DeliveryOrderBind();

                if (getQueryString_DeliveryOrder > 0)
                {
                    BLL.DeliveryOrder EditDO = new BLL.DeliveryOrder();
                    EditDO.LoadByPrimaryKey(getQueryString_DeliveryOrder);
                    txtCarNumber.Text = EditDO.CarNumber;
                    txtClientCode.Text = (EditDO.ClientCode).ToString();
                    txtkiloMeterAfter.Text = EditDO.KilometerCounterAfter.ToString();
                    txtKiloMeterBefore.Text = EditDO.KilometerCounterBefore.ToString();
                    txtTotalPrice.Text = EditDO.TotalPrice.ToString();
                    txtGeneralDeliveryCode.Text = EditDO.GeneralDeliveryCode;
                    drpTransformationSupplier.Text = EditDO.TransformationSupplier;
                    txtDriverName.Text = EditDO.DriverName;
                    txtDriverNationID.Text = EditDO.DriverNationID.ToString();
                    txtDriverTelephone.Text = EditDO.DriverTelephone;
                    txtCarType.Text = EditDO.CarType;
                    txtDepartmentResponsable.Text = EditDO.DepartmentResponsableName;
                    txtDeliveryOrderDate.Text = EditDO.DeliveryOrderDate.ToString("dd/MM/yyyy");
                    txtPermission.Text = EditDO.PermationNumber.ToString();
                    drpDepartment.Text = EditDO.Department;
                    txtDeliveryOrderName.Text = EditDO.DeliveryOrderName;
                    drpStatusGeneral.SelectedValue = EditDO.DeliveryOrderStatusID.ToString();
                    drpDepartment.SelectedValue = EditDO.DepartmentID.ToString();
                    DeliveryOrderDetailsBind();

                    WidGrdGeneralDeliveryOrder.Visible = false;
                    WidEditDeliveryOrder.Visible = true;
                    PanelDeliveryOrderDetails.Visible = true;
                    createNewDeliveryOrder.Visible = false;
                }

                if (getQueryString_DeliveryOrderDetails > 0)
                {
                    DeliveryOrderDetails DODEdit = new DeliveryOrderDetails();
                    DODEdit.LoadByPrimaryKey(getQueryString_DeliveryOrderDetails);
                    txtDeliveryFrom.Text = DODEdit.DeliveryFrom;
                    txtDeliveryTo.Text = DODEdit.DeliveryTo;
                    txtDateFrom.Text = DODEdit.DateFrom.ToString("HH:mm");
                    txtDateTo.Text = DODEdit.DateTo.ToString("HH:mm");
                    txtRecivableName.Text = DODEdit.ReceivableName;
                    txtRecivableTelephone.Text = DODEdit.ReceivableTelephone;
                    if (!DODEdit.IsColumnNull("Price"))
                        txtPrice.Text = DODEdit.Price.ToString();
                    else
                        txtPrice.Text = "0.0";
                    txtDeliveryOrderCode.Text = DODEdit.DeliveryOrderCode;
                    drpStatusDetails.Text = DODEdit.DeliveryOrderStatusID.ToString();

                    if (!DODEdit.IsColumnNull("WatingHours"))
                        txtWatingHours.Text = DODEdit.WatingHours.ToString();
                    else
                        txtWatingHours.Text = "0";

                }

                BLL.DeliveryOrderStatus DOS = new DeliveryOrderStatus();
                DOS.LoadAll();
                drpStatusDetails.DataSource = DOS.DefaultView;
                drpStatusDetails.DataValueField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusID;
                drpStatusDetails.DataTextField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusNameAr;

                drpStatusDetails.DataBind();

                drpStatusGeneral.DataSource = DOS.DefaultView;
                drpStatusGeneral.DataValueField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusID;
                drpStatusGeneral.DataTextField = DeliveryOrderStatus.ColumnNames.DeliveryOrderStatusNameAr;
                drpStatusGeneral.DataBind();

                BLL.TransformationSupplier DOO = new BLL.TransformationSupplier();
                DOO.LoadAll();
                drpTransformationSupplier.DataSource = DOO.DefaultView;
                drpTransformationSupplier.DataValueField = TransformationSupplier.ColumnNames.TransformationSupplierID;
                drpTransformationSupplier.DataTextField = TransformationSupplier.ColumnNames.TransformationSupplierName;
                drpTransformationSupplier.DataBind();

                Department dep = new Department();
                dep.LoadAll();
                drpDepartment.DataSource = dep.DefaultView;
                drpDepartment.DataValueField = Department.ColumnNames.DepartmentID;
                drpDepartment.DataTextField = Department.ColumnNames.DepartmentName;
                drpDepartment.DataBind();

            }
        }