示例#1
0
 string sendInternationalNationalOTP(string mobile, string otp, string countyCode)
 {
     GlobalFuns.SendSMSInternational(mobile, otp + " is your one time password(OTP). Please enter the OTP to proceed. Thank you," + System.Environment.NewLine + "Team ROW", countyCode);
     return("true");
 }
示例#2
0
        public static int SendSMSAndMailToNonSubmitedReports(ClubMonthlyReport_Input Obj)
        {
            try
            {
                MySqlParameter[] param = new MySqlParameter[3];

                param[0] = new MySqlParameter("?p_groupId", Obj.groupId);
                param[1] = new MySqlParameter("?p_month", Obj.month);
                param[2] = new MySqlParameter("?p_type", Obj.type);

                DataSet Result = MySqlHelper.ExecuteDataset(GlobalVar.strAppConn, CommandType.StoredProcedure, "USP_API_SendSMSAndMailToNonSubmitedReports", param);



                int smsEmailflag = 0;

                string month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(Obj.month.Substring(0, 2)));
                string Year  = Obj.month.Substring(3, 4);

                #region SMS sending
                if (Obj.type == "1")
                {
                    DataTable dtMobile = Result.Tables[0];
                    if (dtMobile.Rows.Count > 0)
                    {
                        int    TotalMobileNumberCount = 0;
                        int    CurrentSMScount        = GetBalanceSMS(Obj.groupId.ToString());
                        string MobileNumberIndia      = "";
                        int    MobileNumberCount      = 0;
                        foreach (DataRow row in dtMobile.Rows)
                        {
                            string[] values = row["member_mobile_no"].ToString().Split(',');
                            TotalMobileNumberCount = TotalMobileNumberCount + values.Length;
                        }
                        if (TotalMobileNumberCount < CurrentSMScount)
                        {
                            foreach (DataRow row in dtMobile.Rows)
                            {
                                string[] values = row["member_mobile_no"].ToString().Split(',');
                                if (row["country_code"].ToString() == "+91" && row["member_mobile_no"].ToString() != "")//for India
                                {
                                    MobileNumberIndia += row["member_mobile_no"].ToString() + ",";
                                    MobileNumberCount  = MobileNumberCount + values.Length;
                                }
                                else//for International SMS
                                {
                                    if (row["member_mobile_no"].ToString() != "")//for India
                                    {
                                        if ((GlobalFuns.SendSMSInternational(row["member_mobile_no"].ToString(), "Dear Rtn," + Environment.NewLine + "The monthly report for your club for the month of " + month + " " + Year + " has not been submitted.", row["country_code"].ToString())) == "SMS Send SuccessFully")
                                        {
                                            UpdateInternationalSMSCount(Obj.groupId.ToString());
                                            smsEmailflag = 1;
                                        }
                                    }
                                }
                            }
                            if (MobileNumberIndia != "")
                            {
                                MobileNumberIndia = MobileNumberIndia.TrimEnd(',');
                                if ((GlobalFuns.SendSMSOnAdd(MobileNumberIndia + ",9763128181,9821130855", "Dear Club leader," + Environment.NewLine + "The monthly report of your club for " + month + " " + Year + " has not been submitted. Please submit it  through www.rosteronwheels.com" + Environment.NewLine + " District Governor.")) == true)
                                {
                                    UpdateAllSMSCount(Obj.groupId.ToString(), MobileNumberCount);
                                    smsEmailflag = 1;
                                }
                            }
                        }
                    }
                }
                #endregion

                #region send email
                if (Obj.type == "2")
                {
                    DataTable dtEmail = Result.Tables[0];
                    if (dtEmail.Rows.Count > 0)
                    {
                        if (dtEmail.Rows.Count > 0)
                        {
                            string MailList = dtEmail.Rows[0]["member_email_id"].ToString();
                            if (MailList == "")
                            {
                                MailList += "[email protected],[email protected]";//
                            }
                            else
                            {
                                MailList += ",[email protected],[email protected]";//,[email protected]
                            }

                            if (MailList != "")
                            {
                                MailList = MailList.TrimEnd(',');
                                GlobalFuns.SendEmail(ConfigurationManager.AppSettings["frommail"].ToString(), MailList.Trim().ToString(), "Club Monthly Report not Submitted", msgbody(month + " " + Year));
                            }
                        }
                    }
                }

                #endregion
                return(smsEmailflag);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }