protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        e.NewValues["RefNo"]          = SafeValue.SafeString(e.NewValues["RefNo"]);
        e.NewValues["OriginAdd"]      = SafeValue.SafeString(e.NewValues["OriginAdd"]);
        e.NewValues["DestinationAdd"] = SafeValue.SafeString(e.NewValues["DestinationAdd"]);
        e.NewValues["CustomerName"]   = SafeValue.SafeString(e.NewValues["CustomerName"]);
        e.NewValues["Contact"]        = SafeValue.SafeString(e.NewValues["Contact"]);
        e.NewValues["TruckNo"]        = SafeValue.SafeString(e.NewValues["TruckNo"]);
        e.NewValues["Value1"]         = SafeValue.SafeString(e.NewValues["Value1"]);
        e.NewValues["Value2"]         = SafeValue.SafeString(e.NewValues["Value2"]);
        e.NewValues["Value3"]         = SafeValue.SafeString(e.NewValues["Value3"]);
        e.NewValues["WorkStatus"]     = SafeValue.SafeString(e.NewValues["WorkStatus"]);
        e.NewValues["JobDate"]        = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        e.NewValues["MoveDate"]       = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        e.NewValues["PackRmk"]        = SafeValue.SafeString(e.NewValues["PackRmk"]);
        e.NewValues["MoveRmk"]        = SafeValue.SafeString(e.NewValues["MoveRmk"]);
        e.NewValues["TruckNo"]        = SafeValue.SafeString(e.NewValues["TruckNo"]);
        e.NewValues["VolumneRmk"]     = SafeValue.SafeString(e.NewValues["VolumneRmk"]);
        e.NewValues["Note1"]          = SafeValue.SafeString(e.NewValues["Note1"]);
        e.NewValues["Note2"]          = SafeValue.SafeString(e.NewValues["Note2"]);
        DateTime     jobDate   = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        ASPxTimeEdit date_Time = grid.FindEditRowCellTemplateControl(null, "date_Time") as ASPxTimeEdit;
        string       jobTime   = SafeValue.SafeDateStr(e.NewValues["JobDate"]);
        DateTime     moveDate  = DateTime.Parse(jobDate.ToString("yyyy-MM-dd") + " " + date_Time.Text);

        e.NewValues["MoveDate"] = SafeValue.SafeDate(moveDate, DateTime.Now);
        //e.NewValues["MoveDate"] = SafeValue.SafeDate(date_Time.Value, DateTime.Now);
    }
 private void FixYear(ASPxTimeEdit editor)
 {
     if (editor?.Value is DateTime)
     {
         var time = (DateTime)editor.Value;
         editor.Value = time.AddYears(Math.Max(2000 - time.Year, 0));
     }
 }
        private void FixYear(ASPxTimeEdit editor) {
            if (editor == null)
                return;

            if (editor.Value is DateTime) {
                var time = (DateTime)editor.Value;
                editor.Value = time.AddYears(Math.Max(2000 - time.Year, 0));
            }
        }
Beispiel #4
0
        private void FixYear(ASPxTimeEdit editor)
        {
            if (editor == null)
            {
                return;
            }

            if (editor.Value is DateTime)
            {
                DateTime time = (DateTime)editor.Value;
                editor.Value = time.AddYears(Math.Max(2000 - time.Year, 0));
            }
        }
Beispiel #5
0
 protected override void SetupControl(WebControl control)
 {
     base.SetupControl(control);
     if (control is ASPxTimeEdit)
     {
         ASPxTimeEdit aSPxDateEdit = (ASPxTimeEdit)control;
         //aSPxDateEdit.CalendarProperties.DisplayFormatString = base.DisplayFormat;
         aSPxDateEdit.EditFormat          = EditFormat.Custom;
         aSPxDateEdit.EditFormatString    = base.EditMask;
         aSPxDateEdit.DisplayFormatString = TimeFormat;
         //aSPxDateEdit.CalendarProperties.DaySelectedStyle.CssClass = "ASPxSelectedItem";
         aSPxDateEdit.DateChanged += new EventHandler(this.SelectedDateChangedHandler);
     }
 }
Beispiel #6
0
        public List<WebControl> RenderControl(XmlNode xmlControl)
        {
            base.Initialize(xmlControl);

            ASPxTimeEdit aspxTimeEdit = new ASPxTimeEdit
            {
                ID = _PropertyMapper.GetID()
            };

            aspxTimeEdit.ValidationSettings.SetFocusOnError = true;
            aspxTimeEdit.ValidationSettings.RequiredField.IsRequired = _PropertyMapper.Required();
            aspxTimeEdit.ValidationSettings.RequiredField.ErrorText = "Campo Requerido";
            aspxTimeEdit.ValidationSettings.ValidationGroup = "InputValidation";

            _Controls.Add(aspxTimeEdit);

            return _Controls;
        }
        protected void gridDanhSach_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            string ID = e.Keys[0].ToString();


            ASPxGridView grid = sender as ASPxGridView;
            ASPxTimeEdit te   = grid.FindEditRowCellTemplateControl(grid.Columns["GioBatDau"] as GridViewDataColumn, "GioBatDau") as ASPxTimeEdit;
            object       obj  = e.NewValues["GioBatDau"].ToString();



            string GioBatDau  = DateTime.Parse(e.NewValues["GioBatDau"].ToString()).ToString("hh:mm tt");
            string GioKetThuc = DateTime.Parse(e.NewValues["GioKetThuc"].ToString()).ToString("hh:mm tt");
            string TyLe       = e.NewValues["TyLe"].ToString();

            data = new dtGio();
            data.Sua(ID, DateTime.Parse(GioBatDau), DateTime.Parse(GioKetThuc), TyLe);
            e.Cancel = true;
            gridDanhSach.CancelEdit();
            LoadGrid();
        }
        public override System.Web.UI.Control Build()
        {
            base.Build();
            ASPxTimeEdit te = new ASPxTimeEdit();

            te.Width            = ModuleField.Width;
            te.Height           = ModuleField.Height;
            te.EditFormatString = ModuleField.DisplayFormat;
            te.ValidationSettings.RequiredField.IsRequired = ModuleField.IsRequired;
            te.ValidationSettings.RequiredField.ErrorText  = ModuleField.ErrorText;
            //te.NullText = ModuleField.NullText;没有NullText方法
            if (ModuleField.CurrentValue != null)
            {
                te.DateTime = Convert.ToDateTime(ModuleField.CurrentValue);
            }
            else
            {
                te.DateTime = Convert.ToDateTime(ModuleField.DefaultValue);
            }
            return(te);
        }
Beispiel #9
0
    protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.NewValues["JobType"]        = "OUT3";
        e.NewValues["Value1"]         = "Pending";
        e.NewValues["OriginAdd"]      = SafeValue.SafeString(e.NewValues["OriginAdd"]);
        e.NewValues["DestinationAdd"] = SafeValue.SafeString(e.NewValues["DestinationAdd"]);
        e.NewValues["CustomerName"]   = SafeValue.SafeString(e.NewValues["CustomerName"]);
        e.NewValues["Contact"]        = SafeValue.SafeString(e.NewValues["Contact"]);
        e.NewValues["TruckNo"]        = SafeValue.SafeString(e.NewValues["TruckNo"]);
        e.NewValues["Value1"]         = SafeValue.SafeString(e.NewValues["Value1"]);
        e.NewValues["Value2"]         = SafeValue.SafeString(e.NewValues["Value2"]);
        e.NewValues["Value3"]         = SafeValue.SafeString(e.NewValues["Value3"]);
        //e.NewValues["WorkStatus"] = SafeValue.SafeString(e.NewValues["WorkStatus"]);
        e.NewValues["JobDate"]    = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        e.NewValues["MoveDate"]   = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        e.NewValues["PackRmk"]    = SafeValue.SafeString(e.NewValues["PackRmk"]);
        e.NewValues["MoveRmk"]    = SafeValue.SafeString(e.NewValues["MoveRmk"]);
        e.NewValues["TruckNo"]    = SafeValue.SafeString(e.NewValues["TruckNo"]);
        e.NewValues["VolumneRmk"] = SafeValue.SafeString(e.NewValues["VolumneRmk"]);
        e.NewValues["Note1"]      = SafeValue.SafeString(e.NewValues["Note1"]);
        e.NewValues["Note2"]      = SafeValue.SafeString(e.NewValues["Note2"]);
        e.NewValues["Value4"]     = SafeValue.SafeString(e.NewValues["Value4"]);
        e.NewValues["Value5"]     = SafeValue.SafeString(e.NewValues["Value5"]);
        e.NewValues["DateTime1"]  = SafeValue.SafeDate(e.NewValues["DateTime1"], DateTime.Now);
        e.NewValues["DateTime2"]  = SafeValue.SafeDate(e.NewValues["DateTime2"], DateTime.Now);
        e.NewValues["DateTime3"]  = SafeValue.SafeDate(e.NewValues["DateTime3"], DateTime.Now);
        e.NewValues["DateTime4"]  = SafeValue.SafeDate(e.NewValues["DateTime4"], DateTime.Now);
        e.NewValues["DateTime5"]  = SafeValue.SafeDate(e.NewValues["DateTime5"], DateTime.Now);
        DateTime     jobDate   = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now);
        ASPxTimeEdit date_Time = grid.FindEditRowCellTemplateControl(null, "date_Time") as ASPxTimeEdit;
        string       jobTime   = SafeValue.SafeDateStr(e.NewValues["JobDate"]);
        DateTime     moveDate  = DateTime.Parse(jobDate.ToString("yyyy-MM-dd") + " " + date_Time.Text);

        e.NewValues["MoveDate"] = SafeValue.SafeDate(moveDate, DateTime.Now);
        string refNo = SafeValue.SafeString(e.NewValues["RefNo"]);

        e.NewValues["RefNo"] = refNo;
        C2Setup.SetNextNo("", "Materials-OUT3", refNo, DateTime.Now);
        e.NewValues["WorkStatus"] = "Cancel";
    }
        private void EditItem()
        {
            if (FormsHelper.GetSelectedId(gv) == null)
            {
                lblErrorLineas.Text = "Debe Seleccionar una linea para Modificar";
            }
            else if (gv.Selection.Count != 1)
            {
                lblErrorLineas.Text = "Solo puede modificar una linea por vez. Quite la marca a las que no modificara en este momento.";
            }
            else
            {
                try
                {
                    var id = FormsHelper.GetSelectedId(gv);

                    if (id.HasValue)
                    {
                        var linea = mycert.Find(x => x.RecId == (int)gv.GetSelectedFieldValues("RecId")[0]);

                        //Para tener el ID en el momento en que vaya a guardar.
                        pnlEditLine.Attributes.Add("RecId", linea.RecId.ToString());

                        ucIdentifAvisoEdit.SelectedValue = linea.IdentifAviso;

                        AvisosDTO aviso = Business.Avisos.Read(string.Format("IdentifAviso = '{0}'", ucIdentifAvisoEdit.SelectedValue));

                        if (aviso != null)
                        {
                            spDuracionEdit.Value            = aviso.Duracion;
                            ASPxTimeEdit miTimeEdit         = new ASPxTimeEdit();
                            miTimeEdit.DateTime             = Convert.ToDateTime(gv.GetSelectedFieldValues("Hora")[0].ToString());
                            teHoraInicioModificar.DateTime  = miTimeEdit.DateTime;
                            spAvisoModifiSalidas.Value      = gv.GetSelectedFieldValues("Salida")[0].ToString();
                            teHoraInicioModificar.Enabled   = spAvisoModifiSalidas.Text == "0";
                            spAvisoModifiSalidas.Enabled    = teHoraInicioModificar.Enabled == false;
                        }

                        gv.CancelEdit();

                        trEditLine.Visible = true;

                        trAccion.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    MsgErrorLinas(ex);
                }
            }
        }
Beispiel #11
0
 public static void SetTimeEditValue(ASPxTimeEdit de, object objects)
 {
     try
     {
         if (objects != null)
             de.Value = objects.ToString();
     }
     catch (Exception ex)
     {
         SiAuto.Main.LogString("Lỗi SetTimeEditValue :", ex.ToString());
     }
 }
Beispiel #12
0
    public static string GetTimeEditValue(ASPxTimeEdit de)
    {
        string result = "";
        try
        {
            result = de.Text;
        }
        catch (Exception ex)
        {
            SiAuto.Main.LogString("Lỗi GetTimeEditValue :", ex.ToString());
        }

        return result;
    }
Beispiel #13
0
        private static void GetOrSetProperties(HtmlTable tblABM, object entidad, eGetOrSet getOrSet)
        {
            ASPxTextBox  tx;
            ucComboBox   uc;
            PropertyInfo myPropInfo;
            Type         entityType;

            PropertyInfo[] myPropertyInfo;

            //Recorro las properties de la entidad...
            //Por cada prop, busco en la tabla, un control tx[PROP], o uc[PROP] que coincida.
            //Si lo encuentro, lo cargo (Text o SelectedValue) con el valor de la propiedad.

            //Itero entre las propiedades de la entidad.
            entityType     = entidad.GetType();
            myPropertyInfo = entityType.GetProperties((BindingFlags.Public | BindingFlags.Instance));
            for (int i = 0; i < myPropertyInfo.Length; i++)
            {
                tx         = null;
                uc         = null;
                myPropInfo = ((PropertyInfo)myPropertyInfo[i]);

                if (myPropInfo.CanRead)
                {
                    tx = FindTextBoxByName(myPropInfo.Name, tblABM);
                    if (tx != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            tx.Text = Convert.ToString(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, tx.Text, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            tx.Text = string.Empty;
                        }
                    }

                    uc = FindComboBoxByName(myPropInfo.Name, tblABM);
                    if (uc != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            uc.SelectedValue = Convert.ToString(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, uc.SelectedValue, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            uc.SelectedValue = string.Empty;
                        }
                    }

                    ASPxSpinEdit sp = (ASPxSpinEdit)FindControlByName("sp" + myPropInfo.Name, tblABM);
                    if (sp != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                sp.Value = Convert.ToDecimal(myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                sp.Value = null;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, sp.Value, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            sp.Value = null;
                        }
                    }

                    ASPxCheckBox cb = (ASPxCheckBox)FindControlByName("cb" + myPropInfo.Name, tblABM);
                    if (cb != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            cb.Checked = Convert.ToBoolean(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, cb.Checked, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            cb.Checked = false;
                        }
                    }

                    ASPxRadioButtonList rb = (ASPxRadioButtonList)FindControlByName("rb" + myPropInfo.Name, tblABM);
                    if (rb != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            rb.SelectedItem = rb.Items.FindByValue(Convert.ToString(myPropInfo.GetValue(entidad, null)).Trim());
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            if (rb.SelectedItem != null)
                            {
                                myPropInfo.SetValue(entidad, rb.SelectedItem.Value, null);
                            }
                            else
                            {
                                myPropInfo.SetValue(entidad, null, null);
                            }
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            rb.SelectedIndex = -1;
                        }
                    }

                    ASPxTimeEdit te = (ASPxTimeEdit)FindControlByName("te" + myPropInfo.Name, tblABM);
                    if (te != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                te.DateTime = ConvertToDateTime((TimeSpan)myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                te.DateTime = DateTime.MinValue;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, ConvertToTimeSpan(te.DateTime), null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            te.DateTime = DateTime.MinValue;
                        }
                    }

                    ASPxDateEdit de = (ASPxDateEdit)FindControlByName("de" + myPropInfo.Name, tblABM);
                    if (de != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                de.Date = Convert.ToDateTime(myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                de.Value = null;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, de.Date, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            de.Value = null;
                        }
                    }
                }
            }
        }