protected void ASPxMenu2_ItemClick(object source, DevExpress.Web.MenuItemEventArgs e)
        {
            if (ValidarConexionYUsuarioLogueado(new object()))
            {
                return;
            }

            try
            {
                var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "CODE_SKU" });
                foreach (var t in fieldValues)
                {
                    _objSeller.InsertSellerBySku(Session["connectionString"].ToString(), t.ToString(), Session["SELLER_CODE_BY_SKU"].ToString(), Session["USER"].ToString());
                }

                for (var i = 0; i < ASPxGridView2.VisibleRowCount; i++)
                {
                    if (!ASPxGridView2.Selection.IsRowSelected(i))
                    {
                        var fieldValues2 = ASPxGridView2.GetRowValues(i, new[] { "CODE_SKU" });
                        _objSeller.DeleteSellerBySku(Session["connectionString"].ToString(), fieldValues2.ToString(), Session["SELLER_CODE_BY_SKU"].ToString());
                        //fieldValues2.ToString();
                    }
                }
                GetSellerBySku();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
 protected void ASPxButton3_Click(object sender, EventArgs e)
 {
     try
     {
         var fieldValues2 = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID" });
         foreach (var t in fieldValues2)
         {
             _objTask.DeleteTask(Session["connectionString"].ToString(), t.ToString());
         }
         var fieldValues3 = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID", "OPERADOR" });
         foreach (object[] value in fieldValues3)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS", "ConnectNJS('" + value[1].ToString().ToUpper() + "' , 'CANCEL_TASK')", true);
         }
         var pResult = "";
         var ds      = _objTask.GetAllTaskStatus(Session["connectionString"].ToString(), ASPxDateEdit4.Date, ASPxDateEdit3.Date, ref pResult);
         if (pResult == "")
         {
             Session["DATA_TASK2"]    = ds;
             ASPxGridView2.DataSource = ds;
             ASPxGridView2.DataBind();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
Example #3
0
        protected void ASPxGridView2_SelectionChanged(object sender, EventArgs e)
        {
            string[]      s         = { "Course_id" };
            List <object> keyValues = ASPxGridView2.GetSelectedFieldValues(s);

            HiddenField1.Value = keyValues[0].ToString();
        }
Example #4
0
 protected void uruncek_Click(object sender, EventArgs e)
 {
     genelad.Text   = ASPxGridView2.GetSelectedFieldValues("UADI")[0].ToString();
     markaad.Text   = ASPxGridView2.GetSelectedFieldValues("MARKA")[0].ToString();
     modelad.Text   = ASPxGridView2.GetSelectedFieldValues("MODEL")[0].ToString();
     satisfiy.Text  = ASPxGridView2.GetSelectedFieldValues("SATFIY")[0].ToString();
     alisfiy.Text   = ASPxGridView2.GetSelectedFieldValues("ALFIY")[0].ToString();
     miktar.Text    = ASPxGridView2.GetSelectedFieldValues("MIKTAR")[0].ToString();
     satismikt.Text = ASPxGridView2.GetSelectedFieldValues("SATMIKTAR")[0].ToString();
 }
        protected void ASPxButton1_Click(object sender, EventArgs e)
        {
            try
            {
                var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID" });
                foreach (var t in fieldValues)
                {
                    if (ASPxGridLookup1.Text != null)
                    {
                        //var data = ASPxGridLookup1.Text.Split(new Char[] { ';' }); //ASPxGridLookup1.GridView.GetSelectedFieldValues("CORRELATIVE");
                        var count = ASPxGridLookup1.Text;
                        //Modificar Operador
                        _objTask.UpdateUserTask(Session["connectionString"].ToString(), t.ToString(), count);
                    }
                }
                var fieldValues2 = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID", "OPERADOR", "ESTATUS" });
                foreach (object[] value in fieldValues2)
                {
                    if (ASPxGridLookup1.Text != null)
                    {
                        if (value[2].ToString() != "CLOSED" && value[2].ToString() != "COMPLETED")
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS", "SyncOperators('" + value[1].ToString().ToUpper() + "','" + ASPxGridLookup1.Text.ToUpper() + "')", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
            try
            {
                var pResult = "";
                var ds      = _objTask.GetAllTaskStatus(Session["connectionString"].ToString(), ASPxDateEdit4.Date, ASPxDateEdit3.Date, ref pResult);
                if (pResult == "")
                {
                    Session["DATA_TASK2"]    = ds;
                    ASPxGridView2.DataSource = ds;
                    ASPxGridView2.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                }
                //Thread.Sleep(2000);

                //ScriptManager.RegisterStartupScript(this, this.GetType(), "FuncionNJS", "ConnectNJS('" + ASPxGridLookup1.Text.ToString().ToUpper() + "')", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
Example #6
0
        protected void ASPxButton2_Click(object sender, EventArgs e)
        {
            conn = new OracleConnection(dbyol);
            conn.Open();

            cmd = new OracleCommand("Delete From URUNSATISI Where ID = :id", conn);
            cmd.Parameters.AddWithValue(":id", ASPxGridView2.GetSelectedFieldValues("ID")[0].ToString());



            cmd.ExecuteNonQuery();
            conn.Close();

            Response.Redirect("UrunSatisi.aspx");
        }
        public void UpdateTask(string action)
        {
            try
            {
                var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID", "OPERADOR", "ESTATUS" });
                foreach (object[] value in fieldValues)
                {
                    if (value[2].ToString() == "CLOSED" || value[2].ToString() == "COMPLETED")
                    {
                        continue;
                    }
                    _objTask.UpdateActionTask(Session["connectionString"].ToString(), value[0].ToString(), action);

                    if (action == "PLAY")
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS",
                                                            "ConnectNJS('" + value[1].ToString().ToUpper() + "' , 'PLAY_TASK')", true);
                    }
                    if (action == "STOP")
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS",
                                                            "ConnectNJS('" + value[1].ToString().ToUpper() + "' , 'PAUSE_TASK')", true);
                    }
                }
                var pResult = "";
                var ds      = _objTask.GetAllTaskStatus(Session["connectionString"].ToString(), ASPxDateEdit4.Date, ASPxDateEdit3.Date, ref pResult);
                if (pResult == "")
                {
                    Session["DATA_TASK2"]    = ds;
                    ASPxGridView2.DataSource = ds;
                    ASPxGridView2.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
Example #8
0
 protected void ASPxButton5_Click(object sender, EventArgs e)
 {
     try
     {
         var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID" });
         foreach (var t in fieldValues)
         {
             _objTask.UpdateActionTask(Session["connectionString"].ToString(), t.ToString(), "CLOSED");
         }
         var fieldValues2 = ASPxGridView2.GetSelectedFieldValues(new[] { "TASK_ID", "SELLER" });
         foreach (object[] value in fieldValues2)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS", "ConnectNJS('" + value[1].ToString().ToUpper() + "', 'CANCEL_TASK')", true);
         }
         GetTasksByDate(ASPxCalendar1.SelectedDate);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
        public void ReturnData()
        {
            try
            {
                var fieldValuess = ASPxGridView2.GetSelectedFieldValues(new[] { "PICKING_HEADER", "CODE_CLIENT", "NAME_CUSTOMER", "REFERENCE", "DOC_SAP_RECEPTION", "FF", "TYPE", "ADRESS_CUSTOMER", "CODE_ROUTE", "NAME_ROUTE" });

                var dsPicking = (DataSet)Session["GridPicking"];

                var dsManifiesto = (DataSet)Session["GridManifiesto"];

                foreach (object[] item in fieldValuess)
                {
                    var row = dsPicking.Tables[0].NewRow();
                    row["PICKING_HEADER"]    = item[0];
                    row["CODE_CLIENT"]       = item[1];
                    row["NAME_CUSTOMER"]     = item[2];
                    row["REFERENCE"]         = item[3];
                    row["DOC_SAP_RECEPTION"] = item[4];
                    row["FF"]              = item[5];
                    row["TYPE"]            = item[6];
                    row["ADRESS_CUSTOMER"] = item[7];
                    row["CODE_ROUTE"]      = item[8];
                    row["NAME_ROUTE"]      = item[9];

                    for (var i = 0; i < dsManifiesto.Tables[0].Rows.Count; i++)
                    {
                        if (dsManifiesto.Tables[0].Rows[i]["PICKING_HEADER"].ToString() != item[0].ToString())
                        {
                            continue;
                        }
                        dsManifiesto.Tables[0].Rows.Remove(dsManifiesto.Tables[0].Rows[i]);
                        dsManifiesto.AcceptChanges();
                    }

                    dsPicking.Tables[0].Rows.Add(row);
                }
                Session["GridManifiesto"] = dsManifiesto;
                Session["GridPicking"]    = dsPicking;
                ASPxGridView1.DataSource  = dsPicking;
                var regionCombo1 = (ASPxGridView1.Columns["NAME_CUSTOMER"] as GridViewDataComboBoxColumn);
                if (regionCombo1 != null)
                {
                    regionCombo1.PropertiesComboBox.DataSource = dsPicking.Tables[0].DefaultView.ToTable(true,
                                                                                                         "NAME_CUSTOMER");
                    regionCombo1.PropertiesComboBox.ValueField = "NAME_CUSTOMER";
                    regionCombo1.PropertiesComboBox.TextField  = "NAME_CUSTOMER";
                }
                ASPxGridView1.DataBind();
                ASPxGridView2.DataSource = dsManifiesto;
                var regionCombo2 = (ASPxGridView2.Columns["NAME_CUSTOMER"] as GridViewDataComboBoxColumn);
                if (regionCombo2 != null)
                {
                    regionCombo2.PropertiesComboBox.DataSource = dsManifiesto.Tables[0].DefaultView.ToTable(true,
                                                                                                            "NAME_CUSTOMER");
                    regionCombo2.PropertiesComboBox.ValueField = "NAME_CUSTOMER";
                    regionCombo2.PropertiesComboBox.TextField  = "NAME_CUSTOMER";
                }
                ASPxGridView2.DataBind();
            }
            catch (Exception ex)
            {
                CbpanelGrids.JSProperties.Add("cpError", ex.Message);
            }
        }
Example #10
0
        public void GetGraph(string tipo, int width, int height, string data)
        {
            try
            {
                var sku         = ASPxGridView2.GetSelectedFieldValues(new[] { "DESCRIPTION_SKU" });
                var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "DESCRIPTION_SKU", "INV_DATE", "ON_HAND", "TOTAL" });
                WebChartControl1.Series.Clear();

                WebChartControl1.Width  = width;
                WebChartControl1.Height = height;
                var contador = from x in sku
                               group x by x into g
                               let count = g.Count()
                                           orderby count ascending
                                           select new { Value = g.Key, Count = count };
                var table = CreateChartData(fieldValues);
                try
                {
                    foreach (var x in contador)
                    {
                        //ChartTitle ct = new ChartTitle();
                        //ct.Text = Convert.ToString(x.Value);
                        Series series;
                        switch (tipo)
                        {
                        case "Line":
                            series = new Series(Convert.ToString(x.Value), ViewType.Line);
                            break;

                        case "Bar":
                            series = new Series(Convert.ToString(x.Value), ViewType.Bar);
                            break;

                        case "Spline":
                            series = new Series(Convert.ToString(x.Value), ViewType.Spline);
                            break;

                        default:
                            series = new Series(Convert.ToString(x.Value), ViewType.Line);
                            break;
                        }

                        var result = table.Select("SKU ='" + x.Value + "'");
                        foreach (var row in result)
                        {
                            if (data == "on_handVSdate")
                            {
                                series.Points.Add(new SeriesPoint(Convert.ToDateTime(row[1].ToString()).ToString("dd/MM/yyyy"), new[] { Convert.ToDouble(Math.Round(Convert.ToDouble(row[2]), 2)) }));
                                series.CrosshairLabelPattern = "{S} | Cantidad:{V}";
                            }
                            else
                            {
                                series.Points.Add(new SeriesPoint(Convert.ToDateTime(row[1].ToString()).ToString("dd/MM/yyyy"), new[] { Convert.ToDouble(Math.Round(Convert.ToDouble(row[3]), 2)) }));
                                series.CrosshairLabelPattern = "{S} | Total Costo:{V:c}";
                            }
                        }

                        WebChartControl1.Series.Add(series);
                    }
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
                }

                var diagram = WebChartControl1.Diagram as XYDiagram;
                if (diagram == null)
                {
                    return;
                }

                diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Day;
                diagram.AxisX.Title.Text        = "Fechas de Inventario";
                diagram.AxisX.Label.TextPattern = "{A:dd/MM/yyyy}";

                if (data == "on_handVSdate")
                {
                    diagram.AxisY.Title.Text        = "Cantidad de SKUs";
                    diagram.AxisY.Label.TextPattern = "{V}";
                }
                else
                {
                    diagram.AxisY.Title.Text        = "Total Costo";
                    diagram.AxisY.Label.TextPattern = "{V:c}";
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
        protected void ASPxButton1_Click(object sender, EventArgs e)
        {
            try
            {
                //HEADER
                var header = new cod.CountHeader
                {
                    CountType       = ASPxComboBox1.Value.ToString(),
                    CountName       = ASPxTextBox1.Text,
                    CountAssignedTo = ASPxGridLookup1.Text
                };

                //insertar header en tabla
                var dsHeader = _objCount.InsertCountHeader(Session["connectionString"].ToString(), header.CountType, header.CountName, header.CountAssignedTo, Session["USER"].ToString(), ASPxComboBox2.Value.ToString());
                if (dsHeader.Tables[0].Rows.Count > 0)
                {
                    var countId = dsHeader.Tables[0].Rows[0]["ID"].ToString();

                    var tab = ASPxComboBox1.Value.ToString();
                    if (tab == "SKU")
                    {
                        var fieldValues = ASPxGridView1.GetSelectedFieldValues(new[] { "CODE_SKU", "DESCRIPTION_SKU" });
                        foreach (object[] value in fieldValues)
                        {
                            //DETALLES
                            //insertar en detalles
                            var pResult = _objCount.InsertCountDetail(Session["connectionString"].ToString(), countId,
                                                                      "NULL", header.CountAssignedTo, value[0].ToString(), value[1].ToString(), "NULL");
                            if (pResult == "OK")
                            {
                                continue;
                            }
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                                "CallError('Error: " + pResult + "');", true);
                            return;
                        }
                    }
                    if (tab == "LOCATION")
                    {
                        var fieldValues = ASPxGridView2.GetSelectedFieldValues(new[] { "LOCATION", "CODE_LOCATION" });
                        foreach (object[] value in fieldValues)
                        {
                            var pResult = _objCount.InsertCountDetail(Session["connectionString"].ToString(), countId,
                                                                      value[1].ToString(), header.CountAssignedTo, "NULL", "NULL", "NULL");
                            if (pResult == "OK")
                            {
                                continue;
                            }
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                                "CallError('Error: " + pResult + "');", true);
                            return;
                        }
                    }
                    if (tab == "BATCH")
                    {
                        var fieldValues = ASPxGridView3.GetSelectedFieldValues(new[] { "BATCH", "BATCH_ID" });
                        foreach (object[] value in fieldValues)
                        {
                            var pResult = _objCount.InsertCountDetail(Session["connectionString"].ToString(), countId,
                                                                      "NULL", header.CountAssignedTo, "NULL", "NULL", value[1].ToString());
                            if (pResult == "OK")
                            {
                                continue;
                            }
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                                "CallError('Error: " + pResult + "');", true);
                            return;
                        }
                    }
                    //envia el conteo al operador seleccionado
                    ScriptManager.RegisterStartupScript(this, GetType(), "FuncionNJS",
                                                        "ConnectNJS('" + header.CountAssignedTo.ToUpper() + "' , 'NEW_TASK')", true);
                    Response.Redirect("CountPanel.aspx");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: Operación no pudo ser realizada');", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
Example #12
0
        protected void guncelle_Click(object sender, EventArgs e)
        {
            conn = new OracleConnection(dbyol);
            string sql = "Update URUNSATISI set   UADI=:genad,MARKA=:markad,MODEL=:modad,SATFIY=:satfiy,ALFIY=:alfiy,MIKTAR=:mikt,SATMIKTAR=:satmikt Where ID=:id ";

            OracleDataAdapter da = new OracleDataAdapter("Select *from URUNSATISI", conn);

            da.UpdateCommand = new OracleCommand(sql, conn);
            //da.UpdateCommand.Parameters.Add(":ıd", OracleType.Number, 10, "md");

            da.UpdateCommand.Parameters.Add(":genad", OracleType.VarChar, 20, "UAD");

            da.UpdateCommand.Parameters.Add(":markad", OracleType.VarChar, 20, "MARKA");

            da.UpdateCommand.Parameters.Add(":modad", OracleType.VarChar, 20, "MODEL");

            da.UpdateCommand.Parameters.Add(":satfiy", OracleType.VarChar, 20, "SATFIY");

            da.UpdateCommand.Parameters.Add(":alfiy", OracleType.VarChar, 20, "ALFIY");
            da.UpdateCommand.Parameters.Add(":mikt", OracleType.VarChar, 20, "MIKTAR");
            da.UpdateCommand.Parameters.Add(":satmikt", OracleType.VarChar, 20, "SATMIKTAR");



            conn.Open();


            cmd = new OracleCommand("Delete From URUNSATISI Where ID = :id", conn);
            cmd.Parameters.AddWithValue(":id", ASPxGridView2.GetSelectedFieldValues("ID")[0].ToString());



            cmd.ExecuteNonQuery();



            DataSet ds = new DataSet();
            OracleCommandBuilder orac = new OracleCommandBuilder(da);

            da.Fill(ds, "URUNSATISI");


            DataTable dt = ds.Tables["URUNSATISI"];

            DataRow crow = dt.NewRow();



            crow["ID"]    = ASPxGridView2.GetSelectedFieldValues("ID")[0].ToString();
            crow["UADI"]  = genelad.Text;
            crow["MARKA"] = markaad.Text;
            crow["MODEL"] = modelad.Text;


            crow["SATFIY"]    = satisfiy.Text;
            crow["ALFIY"]     = alisfiy.Text;
            crow["MIKTAR"]    = miktar.Text;
            crow["SATMIKTAR"] = satismikt.Text;

            ds.Tables["URUNSATISI"].Rows.Add(crow);



            da.Update(ds, "URUNSATISI");



            conn.Close();


            Response.Redirect("UrunSatisi.aspx");
        }