Ejemplo n.º 1
0
        //*********************** IMPORT LOG *******************************
        public static int InsertUpdateWQX_IMPORT_LOG(int? iMPORT_ID, string oRG_ID, string tYPE_CD, string fILE_NAME, int fILE_SIZE, string iMPORT_STATUS, string iMPORT_PROGRESS,
            string iMPORT_PROGRESS_MSG, byte[] iMPORT_FILE, string uSER_ID)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    T_WQX_IMPORT_LOG t = new T_WQX_IMPORT_LOG();
                    if (iMPORT_ID != null)
                        t = (from c in ctx.T_WQX_IMPORT_LOG
                             where c.IMPORT_ID == iMPORT_ID
                             select c).First();

                    if (iMPORT_ID == null)
                        t = new T_WQX_IMPORT_LOG();

                    if (oRG_ID != null) t.ORG_ID = oRG_ID;
                    if (tYPE_CD != null) t.TYPE_CD = tYPE_CD.Substring(0,5);
                    if (fILE_NAME!= null) t.FILE_NAME = fILE_NAME;
                    t.FILE_SIZE = fILE_SIZE;
                    if (iMPORT_STATUS != null) t.IMPORT_STATUS = iMPORT_STATUS;
                    if (iMPORT_PROGRESS != null) t.IMPORT_PROGRESS = iMPORT_PROGRESS;
                    if (iMPORT_PROGRESS_MSG != null) t.IMPORT_PROGRESS_MSG = iMPORT_PROGRESS_MSG;
                    if (iMPORT_FILE != null) t.IMPORT_FILE = iMPORT_FILE;
                    if (uSER_ID != null) t.CREATE_USERID = uSER_ID;

                    if (iMPORT_ID == null) //insert case
                    {
                        t.CREATE_DT = DateTime.Now;
                        ctx.AddToT_WQX_IMPORT_LOG(t);
                    }
                    else
                    {
                    }

                    ctx.SaveChanges();

                    return t.IMPORT_ID;
                }
                catch
                {
                    return 0;
                }
            }
        }