コード例 #1
0
        public object SendSMSAndMailToNonSubmitedReports(ClubMonthlyReport_Input Obj)
        {
            dynamic       TBClubMonthlyReportListResult;
            List <object> ClubMonthlyReportListResult = new List <object>();

            try
            {
                int Result = clubMonthlyReport.SendSMSAndMailToNonSubmitedReports(Obj);

                if (ClubMonthlyReportListResult != null)
                {
                    TBClubMonthlyReportListResult = new { status = "0", message = "success", Result };
                }
                else
                {
                    TBClubMonthlyReportListResult = new { status = "0", message = "Record not found" };
                }
            }
            catch
            {
                TBClubMonthlyReportListResult = new { status = "1", message = "failed" };
            }

            return(new { TBClubMonthlyReportListResult });
        }
コード例 #2
0
        public object GetMonthlyReportList(ClubMonthlyReport_Input Obj)
        {
            dynamic       TBClubMonthlyReportListResult;
            List <object> ClubMonthlyReportListResult = new List <object>();

            try
            {
                List <ClubMonthlyReportList> Result = clubMonthlyReport.GetMonthlyReportList(Obj);

                //for (int i = 0; i < Result.Count; i++)
                //{
                //    ClubMonthlyReportListResult.Add(new { AttendanceResult = Result[i] });
                //}

                if (ClubMonthlyReportListResult != null)
                {
                    TBClubMonthlyReportListResult = new { status = "0", message = "success", Result };
                }
                else
                {
                    TBClubMonthlyReportListResult = new { status = "0", message = "Record not found" };
                }
            }
            catch
            {
                TBClubMonthlyReportListResult = new { status = "1", message = "failed" };
            }

            return(new { TBClubMonthlyReportListResult });
        }
コード例 #3
0
        //private static TouchBaseWebAPI.Data.row_productionEntities _DbTouchbase = new TouchBaseWebAPI.Data.row_productionEntities();

        public static List <ClubMonthlyReportList> GetMonthlyReportList(ClubMonthlyReport_Input Obj)
        {
            try
            {
                MySqlParameter[] param = new MySqlParameter[5];

                param[0] = new MySqlParameter("?p_profileId", Obj.profileId);
                param[1] = new MySqlParameter("?p_groupId", Obj.groupId);
                param[2] = new MySqlParameter("?p_month", Obj.month);
                param[3] = new MySqlParameter("?p_type", Obj.type);
                param[4] = new MySqlParameter("?p_Fk_ZoneID", Obj.Fk_ZoneID);

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

                //var Result = _DbTouchbase.ExecuteStoreQuery<ClubMonthlyReportList>("CALL USP_API_Mobile_GetMonthlyReportList(?p_profileId,?p_groupId,?p_month,?p_type)", param).ToList();

                DataTable dtResult = Result.Tables[0];
                List <ClubMonthlyReportList> EbulletinList = new List <ClubMonthlyReportList>();

                if (dtResult.Rows.Count > 0)
                {
                    EbulletinList = GlobalFuns.DataTableToList <ClubMonthlyReportList>(dtResult);

                    for (int i = 0; i < EbulletinList.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(EbulletinList[i].reportUrl))
                        {
                            string ebulletinlink = EbulletinList[i].reportUrl.ToString();
                            string path          = System.Configuration.ConfigurationManager.AppSettings["imgPath"] + "Documents/Clubmonthly/Group" + EbulletinList[i].ClubId + "/";
                            EbulletinList[i].reportUrl = path + ebulletinlink;
                        }
                    }
                }

                return(EbulletinList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
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;
            }
        }