Exemple #1
0
        public static bool NotifInsert(string desc, string from, string[] _to, string link, string toolID)
        {
            try {
                DataTable dt = new DataTable();
                dt = ConnectSQL.Execute("SELECT IsNull(MAX(NOTIF_ID),0) FROM NOTIF");
                int newID = Convert.ToInt32(ConnectSQL.GetString(dt, 0));

                SqlDataAdapter da = ConnectSQL.GatDataAdapter("SELECT TOP 1 * FROM NOTIF");
                da.Fill(dt);

                for (int i = 0; i < _to.Length; i++)
                {
                    newID++;
                    DataRow dr = dt.NewRow();
                    dr["NOTIF_ID"]   = newID;
                    dr["NOTIF_DESC"] = desc;
                    dr["NOTIF_DATE"] = DateTime.Now;
                    dr["NOTIF_FORM"] = from;
                    dr["NOTIF_TO"]   = _to[i];
                    dr["NOTIF_FLAG"] = "F";
                    dr["NOTIF_LINK"] = link;
                    dr["TOOL_ID"]    = toolID;
                    dt.Rows.Add(dr);
                }
                da.Update(dt);
                return(true);
            } catch (Exception ex) {
                return(false); // ex.Message;
            }
        }
        public static string checkUsersALL()
        {
            DataTable dataTable = ConnectSQL.Execute("SELECT AD_USER_ID, EMP_ID, EMP_FNAME, EMP_LNAME FROM  PORTAL_PROD.dbo.MV_ALL_USER WHERE AD_USER_ID IS NOT NULL");
            //Convert DataTable to Json
            string jsonMessage = JsonConvert.SerializeObject(dataTable);

            return(jsonMessage);
        }
        public static List <UserProfileFromSQl> SetProfile(string user)
        {
            DataTable dataTable = ConnectSQL.Execute("SELECT distinct ORG_ID,EMP_ID,EMP_FNAME,EMP_LNAME,POS_ID,ROLE_ID,IsNull(E_MAIL,'') AS E_MAIL,IsNull(EMP_NICKNAME,'') AS EMP_NICKNAME FROM  PORTAL_PROD.dbo.MV_ALL_USER WHERE AD_USER_ID = '" + user + "'");

            return(ConvertDataTable <UserProfileFromSQl> (dataTable));
        }