Esempio n. 1
0
        public IList <CountSchedule> Select(CountSchedule data)
        {
            IList <CountSchedule> datos = new List <CountSchedule>();

            try {
                datos = GetHsql(data).List <CountSchedule>();
                if (!Factory.IsTransactional)
                {
                    Factory.Commit();
                }
            }
            catch (Exception e)
            {
                NHibernateHelper.WriteEventLog(WriteLog.GetTechMessage(e));
            }


            return(datos);
        }
Esempio n. 2
0
 public void UpdateCountSchedule(CountSchedule data)
 {
     try
     {
         SetService();
         SerClient.UpdateCountSchedule(data);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
Esempio n. 3
0
 public CountSchedule SaveCountSchedule(CountSchedule data)
 {
     try
     {
         SetService(); return SerClient.SaveCountSchedule(data);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            WMSServiceClient serv = new WMSServiceClient();

            if (rdOpt.IsChecked == true)
            {
                // make the Count document
                if (Products == null || Products.Rows.Count == 0)
                {
                    Util.ShowError("Records not selected");
                    return;
                }

                NewTask();
            }
            else
            {
                //// make the schedule
                if (string.IsNullOrEmpty(Query))
                {
                    Util.ShowError("Records not selected");
                    return;
                }

                if (string.IsNullOrEmpty(txtTitle.Text))
                {
                    Util.ShowError("Name or Reference is required");
                    return;
                }

                if (string.IsNullOrEmpty(txtSchDateFrom.Text))
                {
                    Util.ShowError("Start Date is required");
                    return;
                }
                if (string.IsNullOrEmpty(txtSchDateTo.Text))
                {
                    Util.ShowError("End Date is required");
                    return;
                }
                if (string.IsNullOrEmpty(txtFrecuency.Text))
                {
                    Util.ShowError("Frecuency field is required");
                    return;
                }
                if (txtSchDateFrom.SelectedDate >= txtSchDateTo.SelectedDate)
                {
                    Util.ShowError("End Date must be older than Start Date");
                    return;
                }

                // CAA [2010/05/05] Valida que se incluyan las columnas necesarias en el reporte
                if (cboToDo.SelectedIndex == 0) //Only BIN
                {
                    if (!Query.Contains("as BinCode"))
                    {
                        Util.ShowError("BinCode column missing.");
                        return;
                    }
                }
                else
                    if (cboToDo.SelectedIndex == 1) // BIN & PRODUCT
                    {
                        if (!Query.Contains("as BinCode") || (!Query.Contains("as Product FROM") && !Query.Contains("as Product,")))
                        {
                            Util.ShowError("BinCode and/or Product columns are missing.");
                            return;
                        }
                    }



                CountSchedule sch = new CountSchedule
                {
                    Start = txtSchDateFrom.SelectedDate.Value, // DateTime.Parse(txtSchDateFrom.Text);
                    Finish = txtSchDateTo.SelectedDate.Value, // DateTime.Parse(txtSchDateTo.Text);
                    NextDateRun = txtSchDateFrom.SelectedDate.Value, //.AddDays(double.Parse(txtFrecuency.Text));
                    IsDone = false,
                    Query = Query,
                    Parameters = queryParam.GetXml(),
                    RepeatEach = short.Parse(txtFrecuency.Text),
                    CreatedBy = App.curUser.UserName,
                    CreationDate = DateTime.Now,
                    Location = App.curLocation,
                    CountOption = cboToDo.SelectedIndex,
                    Title = txtTitle.Text
                };
                

                sch = serv.SaveCountSchedule(sch);

                Util.ShowMessage("Cycle Count Scheduled.");
            }

            ClosePopup();
        }
Esempio n. 5
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            WMSServiceClient serv = new WMSServiceClient();

            if (rdOpt.IsChecked == true)
            {
                // make the Count document
                if (Products == null || Products.Rows.Count == 0)
                {
                    Util.ShowError("Records not selected");
                    return;
                }

                NewTask();
            }
            else
            {
                //// make the schedule
                if (string.IsNullOrEmpty(Query))
                {
                    Util.ShowError("Records not selected");
                    return;
                }

                if (string.IsNullOrEmpty(txtTitle.Text))
                {
                    Util.ShowError("Name or Reference is required");
                    return;
                }

                if (string.IsNullOrEmpty(txtSchDateFrom.Text))
                {
                    Util.ShowError("Start Date is required");
                    return;
                }
                if (string.IsNullOrEmpty(txtSchDateTo.Text))
                {
                    Util.ShowError("End Date is required");
                    return;
                }
                if (string.IsNullOrEmpty(txtFrecuency.Text))
                {
                    Util.ShowError("Frecuency field is required");
                    return;
                }
                if (txtSchDateFrom.SelectedDate >= txtSchDateTo.SelectedDate)
                {
                    Util.ShowError("End Date must be older than Start Date");
                    return;
                }

                // CAA [2010/05/05] Valida que se incluyan las columnas necesarias en el reporte
                if (cboToDo.SelectedIndex == 0) //Only BIN
                {
                    if (!Query.Contains("as BinCode"))
                    {
                        Util.ShowError("BinCode column missing.");
                        return;
                    }
                }
                else
                if (cboToDo.SelectedIndex == 1)     // BIN & PRODUCT
                {
                    if (!Query.Contains("as BinCode") || (!Query.Contains("as Product FROM") && !Query.Contains("as Product,")))
                    {
                        Util.ShowError("BinCode and/or Product columns are missing.");
                        return;
                    }
                }



                CountSchedule sch = new CountSchedule
                {
                    Start        = txtSchDateFrom.SelectedDate.Value, // DateTime.Parse(txtSchDateFrom.Text);
                    Finish       = txtSchDateTo.SelectedDate.Value,   // DateTime.Parse(txtSchDateTo.Text);
                    NextDateRun  = txtSchDateFrom.SelectedDate.Value, //.AddDays(double.Parse(txtFrecuency.Text));
                    IsDone       = false,
                    Query        = Query,
                    Parameters   = queryParam.GetXml(),
                    RepeatEach   = short.Parse(txtFrecuency.Text),
                    CreatedBy    = App.curUser.UserName,
                    CreationDate = DateTime.Now,
                    Location     = App.curLocation,
                    CountOption  = cboToDo.SelectedIndex,
                    Title        = txtTitle.Text
                };


                sch = serv.SaveCountSchedule(sch);

                Util.ShowMessage("Cycle Count Scheduled.");
            }

            ClosePopup();
        }
Esempio n. 6
0
        public override IQuery GetHsql(Object data)
        {
            StringBuilder sql           = new StringBuilder("select a from CountSchedule a    where  ");
            CountSchedule countSchedule = (CountSchedule)data;

            if (countSchedule != null)
            {
                Parms = new List <Object[]>();
                if (countSchedule.RowID != 0)
                {
                    sql.Append(" a.RowID = :id     and   ");
                    Parms.Add(new Object[] { "id", countSchedule.RowID });
                }

                if (countSchedule.RepeatEach != 0)
                {
                    sql.Append(" a.RepeatEach = :id1     and   ");
                    Parms.Add(new Object[] { "id1", countSchedule.RepeatEach });
                }

                if (countSchedule.Start != null)
                {
                    sql.Append(" a.Start = :id2     and   ");
                    Parms.Add(new Object[] { "id2", countSchedule.Start });
                }

                if (countSchedule.Finish != null)
                {
                    sql.Append(" a.Finish = :id3     and   ");
                    Parms.Add(new Object[] { "id3", countSchedule.Finish });
                }

                if (countSchedule.NextDateRun != null)
                {
                    sql.Append(" a.NextDateRun = :id4     and   ");
                    Parms.Add(new Object[] { "id4", countSchedule.NextDateRun });
                }

                if (countSchedule.IsDone != null)
                {
                    sql.Append(" a.IsDone = :id5     and   ");
                    Parms.Add(new Object[] { "id5", countSchedule.IsDone });
                }

                //if (!string.IsNullOrEmpty(countSchedule.Title))
                //{
                //    sql.Append(" a.Title like :id6  and   ");
                //    Parms.Add(new Object[] { "id6", "%" + countSchedule.Title + "%" });
                //}

                if (countSchedule.Location != null && countSchedule.Location.LocationID != 0)
                {
                    sql.Append(" a.Location.LocationID = :loc  and   ");
                    Parms.Add(new Object[] { "loc", countSchedule.Location.LocationID });
                }
            }

            sql = new StringBuilder(sql.ToString());
            sql.Append("1=1 order by a.NextDateRun asc");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());

            SetParameters(query);
            return(query);
        }
Esempio n. 7
0
 public CountSchedule SelectById(CountSchedule data)
 {
     return((CountSchedule)base.SelectById(data));
 }
Esempio n. 8
0
 public Boolean Delete(CountSchedule data)
 {
     return(base.Delete(data));
 }
Esempio n. 9
0
 public Boolean Update(CountSchedule data)
 {
     return(base.Update(data));
 }
Esempio n. 10
0
 public CountSchedule Save(CountSchedule data)
 {
     return((CountSchedule)base.Save(data));
 }