示例#1
0
 public DataSet GetSubCont(int grval)
 {
     try
     {
         ____logconfig.Log_Write(____logconfig.LogLevel.INFO, 82, "BL:GetSubCont()::Function starts here.");
         string   sqlstmt = "select contacts from comgt where GroupId=?comgt.groupid";
         string[] arr_val = { grval.ToString() };
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 85, "BL:GetSubCont()::query to select contacts from comgt:" + sqlstmt);
         DataSet ds = DL.DL_ExecuteQuery(sqlstmt, arr_val);
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 87, "BL:GetSubCont()::Result of query to select contacts from comgt, no of rows:" + ds.Tables[0].Rows.Count.ToString());
         if (ds.Tables[0].Rows.Count > 0)
         {
             return(ds);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         ____logconfig.Error_Write(____logconfig.LogLevel.EXC, 99, ex.Message.ToString(), "BL");
         return(null);
     }
 }
示例#2
0
 public DataSet GetAllGroup(System.Web.UI.WebControls.ListItem listItem)
 {
     try
     {
         ____logconfig.Log_Write(____logconfig.LogLevel.INFO, 62, "BL:GetAllGroup()::Function starts here.");
         string   sqlstmt = "select * from comgt where GroupName=?global.username";
         string[] arr     = new string[] { listItem.ToString() };
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 65, "BL:GetAllGroup()::Query to select from comgt:" + sqlstmt);
         DataSet dr = DL.DL_ExecuteQuery(sqlstmt, arr);
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 67, "BL:GetAllGroup()::Result of query to select from comgt, no of rows:" + dr.Tables[0].Rows.Count.ToString());
         return(dr);
     }
     catch (Exception ex)
     {
         ____logconfig.Error_Write(____logconfig.LogLevel.EXC, 72, ex.Message.ToString(), "BL");
         return(null);
     }
 }
示例#3
0
 public DataSet GetFilterValue(string cellval)
 {
     try
     {
         ____logconfig.Log_Write(____logconfig.LogLevel.INFO, 40, "BL:GetFilterValue()::Function starts here.");
         string   sqlstmt = "select * from comgt where GroupId=?grps.groupid";
         string[] arr     = new string[] { cellval };
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 43, "BL:GetFilterValue()::Query to select from comgt:" + sqlstmt);
         DataSet dr = DL.DL_ExecuteQuery(sqlstmt, arr);
         ____logconfig.Log_Write(____logconfig.LogLevel.DB, 45, "BL:GetFilterValue()::Result of query to select from comgt, no of rows:" + dr.Tables[0].Rows.Count.ToString());
         return(dr);
     }
     catch (Exception ex)
     {
         ____logconfig.Error_Write(____logconfig.LogLevel.EXC, 50, ex.Message.ToString(), "BL");
         return(null);
     }
 }
示例#4
0
        public DataSet GetGroupList(string unm)
        {
            try
            {
                ____logconfig.Log_Write(____logconfig.LogLevel.INFO, 18, "BL:GetGroupList()::Function starts here.");
                //string sqlstmt = "select g.GroupName, g.GroupId,count(c.contacts) as No.of Contacts from comgt c,groups g where c.GroupID=g.GroupID and g.UserName=?global.username group by g.Groupname";

                string        str_getgroupid = "select GroupID from groups where UserName=?global.username;";
                string[]      arr_groupid    = new string[] { unm };
                DataSet       ds_groupid     = DL.DL_ExecuteQuery(str_getgroupid, arr_groupid);
                List <string> lstgroupid     = new List <string>();
                if (ds_groupid != null && ds_groupid.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr_groupid in ds_groupid.Tables[0].Rows)
                    {
                        lstgroupid.Add(dr_groupid["GroupID"].ToString());
                    }
                }
                DataSet dr;
                if (lstgroupid.Count > 0)
                {
                    //string sqlstmt = "select g.GroupName, g.GroupId,count(c.contacts) as Contacts from comgt c,groups g where c.GroupID=g.GroupID and g.UserName=?global.username group by g.Groupname";
                    string   sqlstmt = "select g.GroupName, g.GroupId,count(c.cid) as Contacts from comgt c  inner join groups g on c.GroupID=g.GroupID where g.GroupId in (" + string.Join(",", lstgroupid) + ") group by g.GroupId;";
                    string[] arr     = new string[] { unm };
                    ____logconfig.Log_Write(____logconfig.LogLevel.DB, 22, "BL:GetGroupList()::Query to select group details:" + sqlstmt);
                    dr = DL.DL_ExecuteSimpleQuery(sqlstmt);
                    ____logconfig.Log_Write(____logconfig.LogLevel.DB, 24, "BL:GetGroupList()::Result of query to select group details, no of rows:" + dr.Tables[0].Rows.Count.ToString());
                }
                else
                {
                    dr = null;
                }


                return(dr);
            }
            catch (Exception ex)
            {
                ____logconfig.Error_Write(____logconfig.LogLevel.EXC, 29, ex.Message.ToString(), "BL");
                return(null);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = ""; string password = ""; string mobileno = ""; string senderid = ""; string cdmaheader = ""; string message = "";

            try
            {
                if (this.Request.HttpMethod == "GET")
                {
                    username   = this.Request.QueryString["UserName"];
                    password   = this.Request.QueryString["password"];
                    mobileno   = this.Request.QueryString["MobileNo"];
                    senderid   = this.Request.QueryString["SenderID"];
                    cdmaheader = senderid;
                    message    = this.Request.QueryString["Message"];
                }
                if (this.Request.HttpMethod == "POST")
                {
                    username   = this.Request.Form["UserName"];
                    password   = this.Request.Form["password"];
                    mobileno   = this.Request.Form["MobileNo"];
                    senderid   = this.Request.Form["SenderID"];
                    cdmaheader = senderid;
                    message    = this.Request.Form["Message"];
                }
                if (username == null || password == null || (mobileno == null || senderid == null) || message == null)
                {
                    this.Response.Write("Code=0 SendSMS Pageload");
                }
                else
                {
                    //var res = Util.ValidateMobileNumbers(mobileno);
                    ____logconfig.Log_Write(____logconfig.LogLevel.DEBUG, 77, "username==>" + username + "password==>" + password + "mobileno===>" + mobileno + "semderID===>" + senderid + "cdmaheader==>" + cdmaheader + "message==>" + message);
                    var sql   = "select user_id,username,passkey,Activated from user_master where username like binary ?global.username and passkey like binary ?global.passkey";
                    var param = new string[2] {
                        username, password
                    };
                    DataSet dataSet = DL.DL_ExecuteQuery(sql, param);
                    if (dataSet.Tables[0].Rows.Count > 0)
                    {
                        var    userId    = dataSet.Tables[0].Rows[0]["user_id"].ToString();
                        string messageid = dataSet.Tables[0].Rows[0]["username"].ToString() + "-" + this.GenerateId();
                        var    isUnicode = Util.ContainsUnicodeCharacter(message);
                        if (dataSet.Tables[0].Rows[0]["Activated"].ToString() == "1")
                        {
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();

                            foreach (string key in mobileno.Split(','))
                            {
                                var validatedMobileNo = Util.ValidateMobileNumbers(key);
                                if (validatedMobileNo != "" && !dictionary.ContainsKey(validatedMobileNo))
                                {
                                    dictionary.Add(validatedMobileNo, validatedMobileNo);
                                }
                            }
                            if (dictionary.Count != 0)
                            {
                                string mobile_no = string.Join(",", dictionary.Keys.ToList <string>());
                                if (cdmaheader == null)
                                {
                                    cdmaheader = senderid;
                                }

                                if (isUnicode)
                                {
                                    int num = importnum.importdata(username, password, senderid, cdmaheader, message, mobileno, messageid, 2);
                                    if (num > 0)
                                    {
                                        this.Response.Write("MessageSent GUID=\"" + messageid + "\" SUBMITDATE=\"" + DateTime.Now.GetDateTimeFormats()[84] + "\"");
                                    }
                                    else
                                    {
                                        this.Response.Write("Code=0 SendSMS Pageload");
                                    }
                                }
                                else if (Util.MatchTemplate(username, senderid, message))
                                {
                                    int num = importnum.importdata(username, password, senderid, cdmaheader, message, mobileno, messageid, 0);
                                    if (num > 0)
                                    {
                                        this.Response.Write("MessageSent GUID=\"" + messageid + "\" SUBMITDATE=\"" + DateTime.Now.GetDateTimeFormats()[84] + "\"");
                                    }
                                    else
                                    {
                                        this.Response.Write("Code=0 SendSMS Pageload");
                                    }
                                }
                                else
                                {
                                    importnum.ImportInvalidRequest(userId, username, messageid, senderid, message, DateTime.Now.ToString("yyyyMMddHHmmss"), mobileno, "TEMPLATE FAILED.", isUnicode ? "2" : "", 1);
                                    this.Response.Write("Code=0 Template Matching failed");
                                }
                            }
                            else
                            {
                                importnum.ImportInvalidRequest(userId, username, messageid, senderid, message, DateTime.Now.ToString("yyyyMMddHHmmss"), mobileno, "INVALID MOBILE FAILED.", isUnicode ? "2" : "", 2);
                                Response.Write("Code=0 Invalid Mobile Number");
                            }
                        }
                        else
                        {
                            importnum.ImportInvalidRequest(userId, username, messageid, senderid, message, DateTime.Now.ToString("yyyyMMddHHmmss"), mobileno, "USED DEACTIVE FAILED.", isUnicode ? "2" : "", 3);
                            this.Response.Write("Code=0 User Account De-Activated");
                        }
                    }
                    else
                    {
                        this.Response.Write("Invalid username or password");
                    }
                }
            }
            catch (Exception ex)
            {
                this.Response.Write("Code=0 Internal exception occured");
                this.errorlogs.WriteAsync("exception.txt", DateTime.Now.ToString() + "On SMSSUBMIT Page Main method" + ex.ToString());
            }
        }