public HttpResponseMessage SendFeedBack([FromBody] JObject json)
        {
            try
            {
                //Find IP Address Behind Proxy Or Client Machine In ASP.NET
                string IPAdd = string.Empty;
                IPAdd = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

                if (string.IsNullOrEmpty(IPAdd))
                {
                    IPAdd = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                }

                int modID = getModuleID(json.GetValue("URL").ToString());


                DataProviderManager <PKG_POLL> .Provider.insert_FeedBack(modID, json.GetValue("COMMENT").ToString(), json.GetValue("NAME").ToString() + " : " + json.GetValue("CONTACT").ToString(), AuthUser.ID, AuthUser.SubUserID, IPAdd, json.GetValue("WEB_PAGE").ToString());

                //else
                //    DataProviderManager<PKG_POLL>.Provider.insert_FeedBack(modID, comment, name + " : " + contact, null, null, IPAdd, webPage);

                return(Success(1));
            }
            catch (Exception ex)
            {
                CommonFunctions.CatchExceptions(ex);
                return(Success(0));
            }
        }
Exemple #2
0
        public static HttpResponseMessage LogError(Exception ex, string userName = "")
        {
            var statusJson = "\"STATUS\":{ \"ID\" :" + -1 + ", \"TEXT\" : \"" + ConfigurationManager.AppSettings["error_text"] + "\"}";

            CommonFunctions.CatchExceptions(ex, string.Empty, false, userName);

            return(Error(statusJson, HttpStatusCode.InternalServerError));
        }
        public void get_un_id_from_tin(string tin, out int un_id, out string name)
        {
            var _un_id = -3;
            var _name  = "";
            var cmd    = new OracleCommand("tp.NTosService.get_un_id_from_tin");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("v_tin", tin);
            cmd.Parameters.Add("v_un_id", OracleDbType.Int32).Direction         = ParameterDirection.Output;
            cmd.Parameters.Add("v_desc", OracleDbType.NVarchar2, 200).Direction = ParameterDirection.Output;

            string error;

            new OracleDb <PKG_ORG_INFO>().ExecuteNonQuery(cmd, out error, delegate(OracleParameterCollection reader)
            {
                try
                {
                    _un_id = int.Parse(cmd.Parameters["v_un_id"].Value.ToString());
                    _name  = cmd.Parameters["v_desc"].Value.ToString();
                }
                catch (Exception ex)
                {
                    _un_id = -3;
                    _name  = "";
                    CommonFunctions.CatchExceptions(ex, "", false);
                }
            });

            if (!string.IsNullOrEmpty(error))
            {
                throw new Exception(error);
            }

            un_id = _un_id;
            name  = _name;
        }
Exemple #4
0
        //[Route("GetUserModulesWithNotifications")]
        public HttpResponseMessage GetUserModules()
        {
            try
            {
                /*groupby da Select ი იმიტომაა რომ ხანდახან module ები დუბლირებულად მოდის(ერთი და იგივე რამოდენიმეჯერ)*/
                var modulesList = AuthUser.Modules.GroupBy(x => x.ID).Select(g => g.First()).ToList();

                /**
                 * get module Notifications
                 */
                var moduleIds = modulesList.Select(i => i.ID).ToList();

                var externalModuleIDs = modulesList.Where(i => i.ExternalService == 1).Select(i => i.ID).ToList();

                /*notification type 2 == OnMain notifications*/ // .Where(i=>i.Pinned)

                var moduleIdsAsString = moduleIds.FirstOrDefault().ToString();

                for (int i = 1; i < moduleIds.Count; i++)
                {
                    moduleIdsAsString = $"{moduleIdsAsString},{moduleIds[i].ToString()}";
                }


                var externalModuleIdsAsStr = string.Empty;
                for (int i = 1; i < externalModuleIDs.Count; i++)
                {
                    externalModuleIdsAsStr = $"{externalModuleIdsAsStr},{externalModuleIDs[i].ToString()}";
                }

                var notifications =
                    DataProviderManager <PKG_MENU> .Provider.GetNotificationsJson(moduleIdsAsString, 3, AuthUser.UnID,
                                                                                  AuthUser.SubUserID);

                // var externalGroupIcons = DataProviderManager<PKG_MENU>.Provider.GetModuleGroupIcons($",{externalModuleIdsAsStr},");

                //   var externalGroupIconsProp = new JProperty("ExternalGroupIcons", JArray.FromObject(externalGroupIcons.Select(i=> new { Image = i.Item2, ModuleID = i.Item1 })));


                /* mandatory ნოტიფიკაციაში js ფუნქციაში (" da ") ან აურია JSON ი და ქვევით escape ს ვუკეთებ " - ას */

                notifications = notifications.Replace("(\"", "(\\\"");
                notifications = notifications.Replace("\")", "\\\")");
                // old =  (" new = (\"
                var notifProp   = new JProperty("ModuleNotifications", JArray.Parse(notifications));
                var modulesProp = new JProperty("UserModules", JArray.Parse(JsonConvert.SerializeObject(modulesList)));


                var moduleJson = new JObject(modulesProp);
                var notifJson  = new JObject(notifProp);
                // var externalGroupIconsJson = new JObject(externalGroupIconsProp);
                var mergeSettings = new JsonMergeSettings
                {
                    MergeArrayHandling     = MergeArrayHandling.Union,
                    MergeNullValueHandling = MergeNullValueHandling.Merge
                };

                moduleJson.Merge(notifJson, mergeSettings);
                //  moduleJson.Merge(externalGroupIconsJson, mergeSettings);
                return(Success(moduleJson));
            }
            catch (Exception ex)
            {
                CommonFunctions.CatchExceptions(ex, "", false, AuthUser.Username);
            }
            return(Success());
        }
Exemple #5
0
 public HttpResponseMessage LogError([FromBody] Dictionary <string, object> req)
 {
     CommonFunctions.CatchExceptions(new Exception(req["ERROR_TEXT"].ToString()), null, false);
     return(Success());
 }