public IEnumerable <Management> ShowHistory(Input_Management data)
        {
            List <Management> results = new List <Management>();

            try
            {
                Management getvalue = new Management();

                getvalue.U_User  = data.User;
                getvalue.U_ABBNO = data.ABBNO;


                using (HR_SALEDataContext db = new HR_SALEDataContext())
                {
                    var sql = db.HR_SALE_ShowHistory(data.USERONLINE);
                    foreach (var ux in sql)
                    {
                        Management.GetManagement mp = new Management.GetManagement();

                        //mp.FULLNAME = ux.FULLNAME;
                        mp.ID_ST  = ux.STCODE;
                        mp.ABBNO  = ux.ABBNO;
                        mp.QTY    = ux.QTY.ToString();
                        mp.NET    = ux.NET;
                        mp.PTDATE = ux.WORKDATE.ToString();
                        mp.FLAG   = ux.FLAG.ToString();
                        mp.Deteil = ux.DETEIL;

                        getvalue.AnsManagement.Add(mp);
                        //lstMP.Add(mp);
                    }

                    var sql2 = db.HR_SALE_ShowPI(data.USERONLINE, data.ABBNO);

                    foreach (var ux in sql2)
                    {
                        Management.GetPro sp = new Management.GetPro();

                        sp.MPCODE = ux.MPCODE;
                        sp.MPNAME = ux.FULLNAME;
                        sp.QTY    = ux.QTY.ToString();
                        sp.DETAIL = ux.DETEIL;
                        sp.row    = Int32.Parse(ux.Row_.ToString());

                        getvalue.ShowManagement.Add(sp);
                        //lstMP.Add(mp);
                    }
                }

                results.Add(getvalue);
            }
            catch (Exception ex)
            {
                //Detail res = new Detail();
                //res.status = "F";
                //res.message = ex.Message;
                //results.Add(res);
            }

            return(results.ToArray());
        }
        public IEnumerable <Management> Setting(Input_Management data)
        {
            List <Management> results = new List <Management>();

            try
            {
                Management getvalue = new Management();

                using (HR_SALEDataContext db = new HR_SALEDataContext())
                {
                    if (data.Check == "1")
                    {
                        getvalue.S_User     = data.User;
                        getvalue.S_PTDATE   = data.PTDATE;
                        getvalue.S_ABBNO    = data.ABBNO;
                        getvalue.S_FULLNAME = data.FULLNAME;
                        getvalue.S_QTY      = data.QTY;
                        getvalue.S_NET      = data.NET;

                        var sql_PT = (from xx in db.HR_SALE_PTs
                                      where xx.STCODE == data.User &&
                                      xx.ABBNO == data.ABBNO
                                      select xx).FirstOrDefault();
                        getvalue.Detail = sql_PT.DETEIL;
                    }
                    else if (data.Check == "2")
                    {
                        getvalue.C_ABBNO = data.ABBNO;
                        getvalue.C_User  = data.User;
                    }

                    var sql = db.HR_SALE_GetManagement();
                    foreach (var ux in sql)
                    {
                        Management.GetManagement mp = new Management.GetManagement();

                        mp.FULLNAME = ux.FULLNAME;
                        mp.ID_ST    = ux.STCODE;
                        mp.ABBNO    = ux.ABBNO;
                        mp.QTY      = ux.QTY.ToString();
                        mp.NET      = ux.NET;
                        mp.PTDATE   = ux.PTDATE.ToString();
                        mp.FLAG     = ux.FLAG.ToString();
                        mp.Dpcode   = ux.DPCODE;

                        getvalue.AnsManagement.Add(mp);
                        //lstMP.Add(mp);
                    }

                    var sql2 = db.HR_SALE_ShowPI(data.User, data.ABBNO);

                    foreach (var ux in sql2)
                    {
                        Management.GetPro sp = new Management.GetPro();

                        sp.MPCODE = ux.MPCODE;
                        sp.MPNAME = ux.FULLNAME;
                        sp.QTY    = ux.QTY.ToString();
                        //sp.DETAIL = ux.DETEIL;
                        //sp.row = Int32.Parse(ux.Row_.ToString());

                        getvalue.ShowManagement.Add(sp);
                        //lstMP.Add(mp);
                    }
                    //}

                    results.Add(getvalue);
                }
            }
            catch (Exception ex)
            {
                //Detail res = new Detail();
                //res.status = "F";
                //res.message = ex.Message;
                //results.Add(res);
            }

            return(results.ToArray());
        }