Esempio n. 1
0
        public HttpResponseBase SaveChannelContact()
        {
            chcMgr = new ChannelContactMgr(connectString);

            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["InsertValues"]))
                {
                    string[] Values = Request.Form["InsertValues"].ToString().Split(';');
                    for (int n = 0; n < Values.Length-1; n++)
                    {
                        string[] Val = Values[n].Split(',');

                        chc.contact_type = Val[1].ToString();
                        chc.contact_name = Val[2].ToString();
                        chc.contact_phone1 = Val[3].ToString();
                        chc.contact_phone2 = Val[4].ToString();
                        chc.contact_mobile = Val[5].ToString();
                        chc.contact_email = Val[6].ToString();

                        if (!string.IsNullOrEmpty(Val[0].ToString()))
                        {
                            chc.rid = Int32.Parse(Val[0].ToString());
                            chcMgr.Edit(chc);
                        }
                        else
                        {
                            chc.channel_id = Int32.Parse(Request.Form["channel_id"].ToString());
                            chcMgr.Save(chc);
                        }
                    }
                    json = "{success:true,msg:\"" + Resources.Channel.SUCCESS + "。\"}";
                }
                else
                {
                    json = "{success:true,msg:\"" + Resources.Channel.NO_OPERSTION_DATA + "。\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,msg:\"" + Resources.Channel.FAILED + "\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Esempio n. 2
0
        public HttpResponseBase DeleteContact()
        {
            chcMgr = new ChannelContactMgr(connectString);
            string json = string.Empty;
            int num = 0;
            int rid = 0;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["rid"]))
                {
                    rid = Int32.Parse(Request.Form["rid"].ToString());
                }
                num = chcMgr.Delete(rid);

                if (num > 0)
                {
                    json = "{success:true,msg:\"" + Resources.Channel.SUCCESS + "。\",channelId:" + num.ToString() + "}";
                }
                else
                {
                    json = "{success:true,msg:\"" + Resources.Channel.FAILED + "\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,msg:\"" + Resources.Channel.FAILED + "\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Esempio n. 3
0
        public string QueryContact()
        {
            chcMgr = new ChannelContactMgr(connectString);

            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.QueryString["channel_id"]))
                {
                    json = chcMgr.Query(Request.QueryString["channel_id"].ToString());
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "[]";
            }

            return json;
        }