Beispiel #1
0
        public ActionResult GetBDNoSFBase(string COL_VI1, string COL_VI2, string COL_VI3, string CONS_VAL1, string CONS_VAL2, string CONS_VAL3, string BDNO, string FR_CD)
        {
            IDBContext db     = DatabaseManager.Instance.GetContext();
            var        result = db.Fetch <GETDATA>("CENTRAL010301W/CENTRAL010301WGetSFNBaseData", new { BDNO = BDNO, FR_CD = FR_CD });
            int        index  = 0;

            foreach (GETDATA Item in result)
            {
                Type         type     = Item.GetType();
                PropertyInfo propInfo = type.GetProperty(COL_VI1);
                string       value    = (string)propInfo.GetValue(Item, null);
                if (value.Trim().Contains(CONS_VAL1.Trim()))
                {
                    index++;
                }

                propInfo = type.GetProperty(COL_VI2);
                value    = (string)propInfo.GetValue(Item, null);
                if (value.Trim().Contains(CONS_VAL2.Trim()))
                {
                    index++;
                }

                propInfo = type.GetProperty(COL_VI3);
                value    = (string)propInfo.GetValue(Item, null);
                if (value.Trim().Contains(CONS_VAL3.Trim()))
                {
                    index++;
                }
            }

            return(Json(index, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public IList <PakAnass> SearchCommon(PakAnass o, ViewDataDictionary v, string pageModelViewData, string listViewData)
        {
            Type t = o.GetType();

            int pDot = t.Namespace.LastIndexOf(".");
            int pLen = t.Namespace.Length;

            string dir = (pDot > 1 && (pDot < (pLen - 1))) ? (t.Namespace.Substring(pDot + 1, pLen - pDot - 1) + "/") : "";


            string qCount = dir + t.Name + "_Count";
            string qList  = dir + t.Name + "_List";

            IDBContext db = BaseRepo.Db;

            long count = db.SingleOrDefault <int>(qCount, o);

            BaseModel   m      = o as BaseModel;
            PagingModel pmodel = null;

            if (m.RowsPerPage <= 0)
            {
                pmodel = new PagingModel(count, 1, PagingModel.DEFAULT_RECORD_PER_PAGE);
            }
            else
            {
                pmodel = new PagingModel(count, m.CurrentPage, m.RowsPerPage);
            }

            v[pageModelViewData] = pmodel;

            IList <PakAnass> l = db.Fetch <PakAnass>(qList, o);

            return(l);
        }
        public IEnumerable <SIMPLEGRID> GetSimpleGrid(string plant, string terminal, string partcode, string partdesc, int p_page, int p_length)
        {
            IDBContext        db      = DatabaseManager.Instance.GetContext();
            var               result  = db.Fetch <SIMPLEGRID>("CENTRAL020105W/CENTRAL020105WGetSimpleGrid");
            List <SIMPLEGRID> NewList = new List <SIMPLEGRID>();

            NewList = result.ToList();
            if (plant != null || !String.IsNullOrEmpty(plant))
            {
                NewList = NewList.Where(p => p.PLANT_CD == plant).ToList();
            }
            if (terminal != null || !String.IsNullOrEmpty(terminal))
            {
                NewList = NewList.Where(p => p.TERM_CD == terminal).ToList();
            }
            if (partcode != null || !String.IsNullOrEmpty(partcode))
            {
                NewList = NewList.Where(p => p.PART_CD == partcode).ToList();
            }
            if (partdesc != null || !String.IsNullOrEmpty(partdesc))
            {
                NewList = NewList.Where(p => p.PART_DESC == partdesc).ToList();
            }

            if (p_length != 0 || p_page != 0)
            {
                NewList = NewList.Where(p => p.ROW_NUM >= p_page && p.ROW_NUM <= p_length).ToList();
            }
            db.Close();
            return(NewList);
        }
Beispiel #4
0
        public ActionResult CheckBodyNo(string BDNO, string FR_CD, string MSG_NO)
        {
            IDBContext        db2           = DatabaseManager.Instance.GetContext();
            var               result2       = db2.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WCheckBodyNo", new { BDNO = BDNO });
            List <SIMPLEGRID> newListCheck2 = new List <SIMPLEGRID>();

            newListCheck2 = result2.ToList();
            string result = "";

            if (newListCheck2.Where(p => p.STS == "C").Count() > 0)
            {
                result = "C";
            }
            if (newListCheck2.Where(p => p.STS == "R").Count() > 0)
            {
                result = "RC";
            }
            if (newListCheck2.Count() <= 0)
            {
                result = "R";
            }

            if (newListCheck2.Where(p => p.STS == null || p.STS == "").Count() <= 0)
            {
                result = "RC";
            }

            db2.Close();
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public IEnumerable <SIMPLEGRID> GetSimpleGrid(string BDNO, int p_page, int p_length)
        {
            #region old
            IDBContext        db      = DatabaseManager.Instance.GetContext();
            var               result  = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WGetSimpleGrid");
            List <SIMPLEGRID> NewList = new List <SIMPLEGRID>();
            NewList = result.ToList();
            if (BDNO != null || !String.IsNullOrEmpty(BDNO))
            {
                NewList = NewList.Where(p => p.BDNO.Trim() == BDNO.Trim()).ToList();
            }
            //if (FR_CD != null || !String.IsNullOrEmpty(FR_CD))
            //{
            //    NewList = NewList.Where(p => p.ASD_VINNO.Trim() == FR_CD.Trim()).ToList();

            //}
            //if (MSG_NO != null || !String.IsNullOrEmpty(MSG_NO))
            //{
            //    NewList = NewList.Where(p => p.MSG_NO.Trim() == MSG_NO.Trim()).ToList();

            //}
            if (p_page > 0 || p_length > 0)
            {
                NewList = NewList.Where(p => p.ROW_NUM >= p_page && p.ROW_NUM <= p_length).ToList();
            }
            db.Close();
            return(NewList);

            #endregion
        }
        public int CountData(string plant, string terminal, string partcode, string partdesc)
        {
            int        ResCount = 0;
            IDBContext db       = DatabaseManager.Instance.GetContext();
            var        result   = db.Fetch <SIMPLEGRID>("CENTRAL020105W/CENTRAL020105WGetCountDataCentral");

            List <SIMPLEGRID> intCount = new List <SIMPLEGRID>();

            intCount = result.ToList();

            if (plant != null || !String.IsNullOrEmpty(plant))
            {
                intCount = intCount.Where(p => p.PLANT_CD == plant).ToList();
            }
            if (terminal != null || !String.IsNullOrEmpty(terminal))
            {
                intCount = intCount.Where(p => p.TERM_CD == terminal).ToList();
            }

            if (partcode != null || !String.IsNullOrEmpty(partcode))
            {
                intCount = intCount.Where(p => p.PART_CD == partcode).ToList();
            }
            if (partdesc != null || !String.IsNullOrEmpty(partdesc))
            {
                intCount = intCount.Where(p => p.PART_DESC == partdesc).ToList();
            }
            ResCount = intCount.Count();
            db.Close();
            return(ResCount);
        }
Beispiel #7
0
        public ActionResult GetTblFormatting(string BDNO, string FR_CD, string MSG_NO)
        {
            IDBContext db      = DatabaseManager.Instance.GetContext();
            var        result7 = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WGetTblFtmttng", new { BDNO = BDNO });

            db.Close();
            return(Json(result7, JsonRequestBehavior.AllowGet));
        }
        public List <InterfaceADMObj> ResultAfterAllValidation()
        {
            IDBContext db     = dbManager.GetContext();
            var        Result = db.Fetch <InterfaceADMObj>("GetTPDataAfterAllValidation");

            db.Close();
            return(Result.ToList());
        }
        public List <FTPCredential> GetFtpCredentialSucc(string param, string ID, string sql)
        {
            IDBContext db     = dbManager.GetContext();
            var        Result = db.Fetch <FTPCredential>(sql, new { ID = ID, PARAM = param });

            db.Close();
            return(Result.ToList());
        }
        public List <SysvalObj> getSystemVal()
        {
            IDBContext db     = dbManager.GetContext();
            var        result = db.Fetch <SysvalObj>("GetSystemVal", new { });

            db.Close();
            return(result.ToList());
        }
        public List <InterfaceADMObj> InsertTemp()
        {
            IDBContext db     = dbManager.GetContext();
            var        Result = db.Fetch <InterfaceADMObj>("insertTP", new { });

            db.Close();
            return(Result.ToList());
        }
Beispiel #12
0
        public int CountData2(string source, string frameNo, string katashik, string suffix, string parttype,
                              string partNo, string prodFrom, string status, string format, string prodTo, string start, string len, string from, string to)
        {
            int        ResCount = 0;
            IDBContext db       = DatabaseManager.Instance.GetContext();
            var        result   = db.Fetch <SIMPLEGRID>("CENTRAL030102W/CENTRAL030102WGetCountDataCentral2");

            List <SIMPLEGRID> intCount = new List <SIMPLEGRID>();

            intCount = result.ToList();


            if (source != null || !String.IsNullOrEmpty(source))
            {
                intCount = intCount.Where(p => p.STS == katashik).ToList();
            }
            if (frameNo != null || !String.IsNullOrEmpty(frameNo))
            {
                intCount = intCount.Where(p => p.ASD_VINNO == frameNo).ToList();
            }

            if (katashik != null || !String.IsNullOrEmpty(katashik))
            {
                intCount = intCount.Where(p => p.KATASHIKI == katashik).ToList();
            }
            if (suffix != null || !String.IsNullOrEmpty(suffix))
            {
                intCount = intCount.Where(p => p.SALES_SFX == suffix).ToList();
            }
            if (parttype != null || !String.IsNullOrEmpty(parttype))
            {
                intCount = intCount.Where(p => p.PART_CD == parttype).ToList();
            }
            if (partNo != null || !String.IsNullOrEmpty(partNo))
            {
                intCount = intCount.Where(p => p.VAL == partNo).ToList();
            }

            if (prodFrom != null && prodTo != null)
            {
                DateTime?date_fr = DateTime.ParseExact(prodFrom, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                DateTime?date_to = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                DateTime?date_LO = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);

                intCount = intCount.Where(p => p.LO_DATE >= date_fr && p.LO_DATE <= date_to).ToList();
            }
            if (status != null || !String.IsNullOrEmpty(status))
            {
                intCount = intCount.Where(p => p.STS == status).ToList();
            }
            if (format != null || !String.IsNullOrEmpty(format))
            {
                intCount = intCount.Where(p => p.FR_CD == format).ToList();
            }
            ResCount = intCount.Count();
            db.Close();
            return(ResCount);
        }
Beispiel #13
0
        public IEnumerable <CENTRAL030101W> GetSystem()
        {
            IDBContext db     = DatabaseManager.Instance.GetContext();
            var        result = db.Fetch <CENTRAL030101W>("CENTRAL030101W/CENTRAL030101WGetSystemImg");

            db.Close();

            return(result);
        }
Beispiel #14
0
        public IEnumerable <CENTRAL030101W> GetComboIDNO12(string ID)
        {
            IDBContext db     = DatabaseManager.Instance.GetContext();
            var        result = db.Fetch <CENTRAL030101W>("CENTRAL030101W/CENTRAL030101GetComboIDNO2", new { IDNO = ID });

            db.Close();

            return(result);
        }
        public string getFilename()
        {
            IDBContext db = dbManager.GetContext();

            var result = db.Fetch <string>("getFilename");

            db.Close();
            return(result.FirstOrDefault());
        }
Beispiel #16
0
        public IEnumerable <SIMPLEGRID> GetSimpleGrid(string source, string frameNo, string katashik, string suffix, string parttype,
                                                      string partNo, string prodFrom, string status, string format, string prodTo, string start, string len, string from, string to, int Page, int length)
        {
            IDBContext        db      = DatabaseManager.Instance.GetContext();
            var               result  = db.Fetch <SIMPLEGRID>("CENTRAL030102W/CENTRAL030102WGetSimpleGrid");
            List <SIMPLEGRID> NewList = new List <SIMPLEGRID>();

            NewList = result.ToList();
            //if (source != null || !String.IsNullOrEmpty(source))
            //{
            //    NewList = NewList.Where(p => p.STS.Trim() == source).ToList();

            //}
            if (frameNo != null || !String.IsNullOrEmpty(frameNo))
            {
                NewList = NewList.Where(p => p.ASD_VINNO.Trim() == frameNo).ToList();
            }

            if (katashik != null || !String.IsNullOrEmpty(katashik))
            {
                NewList = NewList.Where(p => p.KATASHIKI.Trim() == katashik).ToList();
            }
            if (suffix != null || !String.IsNullOrEmpty(suffix))
            {
                NewList = NewList.Where(p => p.SALES_SFX.Trim() == suffix).ToList();
            }
            if (parttype != null || !String.IsNullOrEmpty(parttype))
            {
                NewList = NewList.Where(p => p.PART_CD.Trim() == parttype).ToList();
            }
            if (partNo != null || !String.IsNullOrEmpty(partNo))
            {
                NewList = NewList.Where(p => p.VAL.Trim() == partNo).ToList();
            }
            if (prodFrom != null && prodTo != null)
            {
                DateTime?date_fr = DateTime.ParseExact(prodFrom, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                DateTime?date_to = DateTime.ParseExact(prodTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);

                NewList = NewList.Where(p => p.LO_DATE >= date_fr && p.LO_DATE <= date_to).ToList();
            }
            if (status != null || !String.IsNullOrEmpty(status))
            {
                NewList = NewList.Where(p => p.SYSTEM_VALUE_TXT.Trim() == status).ToList();
            }
            if (format != null || !String.IsNullOrEmpty(format))
            {
                NewList = NewList.Where(p => p.FR_CD.Trim() == format).ToList();
            }
            if (Page > 0 || length > 0)
            {
                NewList = NewList.Where(p => p.ROW_NUM >= Page && p.ROW_NUM <= length).ToList();
            }
            db.Close();
            return(NewList);
        }
Beispiel #17
0
        public ActionResult GetPartID(string BDNO, string MSG_NO)//besok
        {
            string            flag    = "";
            IDBContext        db      = DatabaseManager.Instance.GetContext();
            var               result  = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WLooingFormatVal", new { BDNO = @BDNO });
            List <SIMPLEGRID> listSTR = new List <SIMPLEGRID>();

            listSTR = result.ToList();

            List <string> newstrVal = new List <string>();

            newstrVal = listSTR.Select(p => p.FORMAT_VAL).ToList();

            List <string> newstrVal2 = new List <string>();

            newstrVal2 = listSTR.Select(p => p.VAL).ToList();



            for (int i = 0; i < newstrVal.Count(); i++)
            {
                if (newstrVal[i].Length == newstrVal2[i].Length)
                {
                    List <string> format = getFormatList(newstrVal[i]);
                    if (validationFormat(newstrVal2[i], format))
                    {
                        db.Execute("CENTRAL010301W/CENTRAL010301WUpdateSFNCntralOK", new { BDNO = BDNO, MSG_NO = MSG_NO });
                        db.Close();
                        flag = newstrVal2[i].ToString();

                        //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D)
                    }
                    if (!validationFormat(newstrVal2[i], format))
                    {
                        db.Execute("CENTRAL010301W/CENTRAL010301WUpdateNG", new { BDNO = BDNO, MSG_NO = MSG_NO });
                        db.Close();

                        //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D)
                    }
                    else
                    {
                        flag = newstrVal2[i].ToString();
                    }
                }
                else
                {
                    db.Execute("CENTRAL010301W/CENTRAL010301WUpdateNG", new { BDNO = BDNO, MSG_NO = MSG_NO });
                    db.Close();

                    //Insert to log monitoring (TB_R_LOG_H and TB_R_LOG_D)
                }
            }

            db.Close();
            return(Json(flag, JsonRequestBehavior.AllowGet));
        }
Beispiel #18
0
        public IEnumerable <CENTRAL030102W> GetComboStatus()
        {
            IDBContext            db     = DatabaseManager.Instance.GetContext();
            var                   result = db.Fetch <CENTRAL030102W>("CENTRAL030102W/CENTRAL030102WGetComboStatus");
            List <CENTRAL030102W> dbTemp = new List <CENTRAL030102W>();

            dbTemp = result.ToList();
            dbTemp = dbTemp.GroupBy(p => p.SYSTEM_VALUE_TXT).Select(p => p.First()).ToList();
            db.Close();
            return(dbTemp);
        }
        public IEnumerable <CENTRAL020105W> GetComboConstrainNm1()
        {
            IDBContext            db     = DatabaseManager.Instance.GetContext();
            var                   result = db.Fetch <CENTRAL020105W>("CENTRAL020105W/CENTRAL020105WComboConstrainNm");
            List <CENTRAL020105W> dbTemp = new List <CENTRAL020105W>();

            dbTemp = result.ToList();
            dbTemp = dbTemp.GroupBy(p => p.CONS_DESC).Select(p => p.First()).ToList();
            db.Close();
            return(dbTemp);
        }
        public IEnumerable <SIMPLEGRID> GetTerminalEdit(string ID)
        {
            IDBContext        db     = DatabaseManager.Instance.GetContext();
            var               result = db.Fetch <SIMPLEGRID>("CENTRAL020106W/CENTRAL020106WTerminalFromatting", new { PLANT_CD = ID });
            List <SIMPLEGRID> dbTemp = new List <SIMPLEGRID>();

            dbTemp = result.ToList();
            dbTemp = dbTemp.GroupBy(p => p.PLANT_CD).Select(p => p.First()).ToList();
            db.Close();
            return(dbTemp);
        }
        public IEnumerable <CENTRAL020106W> GetComboPartCode(string PlanCD_val)
        {
            IDBContext            db     = DatabaseManager.Instance.GetContext();
            var                   result = db.Fetch <CENTRAL020106W>("CENTRAL020106W/CENTRAL020106WComboPartCode", new { PLANT_CD = PlanCD_val });
            List <CENTRAL020106W> dbTemp = new List <CENTRAL020106W>();

            dbTemp = result.ToList();
            dbTemp = dbTemp.GroupBy(p => p.PART_CD).Select(p => p.First()).ToList();
            db.Close();
            return(dbTemp);
        }
        public IEnumerable <CENTRAL020106W> GetComboPlant()
        {
            IDBContext            db     = DatabaseManager.Instance.GetContext();
            var                   result = db.Fetch <CENTRAL020106W>("CENTRAL020106W/CENTRAL020106WGetComboPlant");
            List <CENTRAL020106W> dbTemp = new List <CENTRAL020106W>();

            dbTemp = result.ToList();
            dbTemp = dbTemp.GroupBy(p => p.PLANT_CD).Select(p => p.First()).ToList();
            db.Close();
            return(dbTemp);
        }
Beispiel #23
0
        public IList <Approval> GetFunctionById(IDBContext db, string functionName)
        {
            dynamic args = new
            {
                FunctionName = functionName
            };

            IList <Approval> Result =
                db.Fetch <Approval>("Po/Po_GetFunctionById", args);

            return(Result);
        }
Beispiel #24
0
        public string get_description(string table_name)
        {
            IDBContext db = DatabaseManager.Instance.GetContext();

            dynamic test = new List <ExpandoObject>();

            var result = db.Fetch <SimpleMasterCustomModel>("Master/SimpleMasterCustom_getDescription", new
            {
                TABLE_NAME = table_name
            });

            return(result.First().DESCRIPTION);
        }
Beispiel #25
0
        public IList <JudgeStatus> GetJudgeStatus(string IdNo, string BodyNo, string PartID)
        {
            IList <JudgeStatus> result = null;

            try
            {
                IDBContext db = DatabaseManager.Instance.GetContext();
                result = db.Fetch <JudgeStatus>("CENTRAL010101W/CENTRAL010101WGetCentral", new { IdNo = IdNo, BodyNo = BodyNo, Val = PartID });
                db.Close();
            }
            catch
            {
            }
            return(result);
        }
Beispiel #26
0
        public IList <TerminalFormat> GetTerminalFormats(string termCd)
        {
            IList <TerminalFormat> result = null;

            try
            {
                IDBContext db = DatabaseManager.Instance.GetContext();
                result = db.Fetch <TerminalFormat>("CENTRAL010101W/CENTRAL010101WGetTerminalFormat", new { TermCd = termCd });
                db.Close();
            }
            catch
            {
            }
            return(result);
        }
Beispiel #27
0
        public IList <Central> GetCentral(string Val, string BodyNo, string IdNo)
        {
            IList <Central> result = null;

            try
            {
                IDBContext db = DatabaseManager.Instance.GetContext();
                result = db.Fetch <Central>("CENTRAL010101W/CENTRAL010101WGetCentral", new { Val = Val, BodyNo = BodyNo, IdNo = IdNo });
                db.Close();
            }
            catch
            {
            }
            return(result);
        }
Beispiel #28
0
        public IList <CentralLog> GetCentralLog(string Val)
        {
            IList <CentralLog> result = null;

            try
            {
                IDBContext db = DatabaseManager.Instance.GetContext();
                result = db.Fetch <CentralLog>("CENTRAL010101W/CENTRAL010101WGetCentralLog", new { Val = Val });
                db.Close();
            }
            catch
            {
            }
            return(result);
        }
        public IEnumerable <STDMessage> GetMessage(string p_MSG_ID)
        {
            IEnumerable <STDMessage> Message = null;
            IDBContext db = DatabaseManager.Instance.GetContext();

            try
            {
                Message = db.Fetch <STDMessage>("STD/GetMessage", new { MSG_ID = p_MSG_ID });
            }
            catch (Exception e)
            {
            }
            db.Close();

            return(Message);
        }
        public int CountData(string BDNO)
        {
            int        ResCount = 0;
            IDBContext db       = DatabaseManager.Instance.GetContext();
            var        result   = db.Fetch <SIMPLEGRID>("CENTRAL010301W/CENTRAL010301WGetCountDataCentral");

            List <SIMPLEGRID> intCount = new List <SIMPLEGRID>();

            intCount = result.ToList();
            if (BDNO != null)
            {
                intCount = intCount.Where(p => p.BDNO.Trim() == BDNO.Trim()).ToList();
            }

            ResCount = intCount.Count();
            db.Close();
            return(ResCount);
        }