コード例 #1
0
ファイル: WebinarDA.cs プロジェクト: selva-osai/scheduler
        public void UpdateWebinarRecurrence(WebinarRecurrencyBE objWebRecurrenceBE)
        {
            try
            {
                string sql1 = string.Empty;

                List<WebinarRecurrencyBE> objP1 = GetWebinarRecurrencyDetail(objWebRecurrenceBE.WebinarID);
                if (objP1.Count > 0)
                    sql1 = DBQuery.sqlWebinarRecurrUpdate;
                else
                    sql1 = DBQuery.sqlWebinarRecurrInsert;

                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {
                    {
                        using (MySqlCommand sqlCmd = new MySqlCommand(sql1, sqlCon))
                        {
                            sqlCmd.CommandType = CommandType.Text;
                            sqlCmd.Parameters.Add(new MySqlParameter("@recurrType", objWebRecurrenceBE.recurrType));
                            sqlCmd.Parameters.Add(new MySqlParameter("@endType", objWebRecurrenceBE.endType));
                            sqlCmd.Parameters.Add(new MySqlParameter("@endValue", objWebRecurrenceBE.endValue));
                            sqlCmd.Parameters.Add(new MySqlParameter("@recurrCriteria", objWebRecurrenceBE.recurrCriteria));
                            sqlCmd.Parameters.Add(new MySqlParameter("@webinarID", objWebRecurrenceBE.WebinarID));
                            sqlCmd.Connection = sqlCon;
                            sqlCmd.Connection.Open();
                            sqlCmd.ExecuteNonQuery();
                            sqlCmd.Connection.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        protected void btnNext_Click(object sender, EventArgs e)
        {
            tabCnt = Convert.ToInt32(hActiveTab.Value);
            int webID = Convert.ToInt32(hWebinarID.Value);
            string rtnVal = string.Empty;
            lblError.Text = "";
            dvValidationMsg.Visible = false;
            switch (tabCnt)
            {
                case 1:
                    #region tab 1
                    if (hIsPast.Value == "0")
                    {
                        if (txtWebinarTitle.Text.Trim() != "" && rdtStartDate.SelectedDate.ToString() != "" && rdtStartTime.SelectedDate.ToString() != "" && rdEndTime.SelectedDate.ToString() != "")
                        {
                            int webinarID = 0;
                            string recurrCond = string.Empty;

                            #region Set webinar info for save
                            objWebinarBE.Createdby = Convert.ToInt32(Session["UserID"]);
                            //objWebinarBE.Description = txtDescription.Text;
                            objWebinarBE.Description = redtSummary.Content;
                            objWebinarBE.isRecurrence = chkRecurrence.Checked;

                            //objWebinarBE.StartDate = objUtil.getGMTDateTime(Convert.ToDateTime(rdtStartDate.SelectedDate + " " + rdtStartTime.SelectedDate));

                            //objWebinarBE.StartTime = Convert.ToDateTime(objUtil.getGMTDateTime(Convert.ToDateTime(rdtStartDate.SelectedDate + " " + rdtStartTime.SelectedDate)).ToString("HH:mm:ss")); //ToLongTimeString();
                            //objWebinarBE.EndTime = Convert.ToDateTime(rdEndTime.SelectedDate).ToString("HH:mm:ss"); //.ToLongTimeString();

                            objWebinarBE.StartDate = Convert.ToDateTime(rdtStartDate.SelectedDate);
                            objWebinarBE.StartTime = Convert.ToDateTime(rdtStartTime.SelectedDate).ToString("HH:mm:ss"); //ToLongTimeString();
                            objWebinarBE.EndTime = Convert.ToDateTime(rdEndTime.SelectedDate).ToString("HH:mm:ss"); //.ToLongTimeString();

                            objWebinarBE.TimeZoneID = Convert.ToInt32(ddlTimeZone.SelectedValue);
                            objWebinarBE.Title = txtWebinarTitle.Text;
                            objWebinarBE.WebinarID = Convert.ToInt32(hWebinarID.Value);
                            if (hWebinarID.Value == "0")
                                objWebinarBE.WebinarStatus = "Active";
                            //Presenters Options
                            if (radioBtnId11.Checked)
                                objWebinarBE.DeliveryChannel = "1";
                            else if (radioBtnId22.Checked)
                                objWebinarBE.DeliveryChannel = "2";
                            else if (radioBtnId33.Checked)
                                objWebinarBE.DeliveryChannel = "3";
                            else
                                objWebinarBE.DeliveryChannel = "0";
                            objWebinarBE.isPublic = chkEmailRegAPI.Checked;

                            #endregion

                            #region recurrence
                            WebinarRecurrencyBE objWebinarRecurrBE = new WebinarRecurrencyBE();

                            if (chkRecurrence.Checked)
                            {
                                //if (rbtnNoEnddate.Checked)
                                //{
                                //    objWebinarRecurrBE.endType = "Noend";
                                //    objWebinarRecurrBE.endValue = "";
                                //}
                                //else
                                if (rbtnEndAfter.Checked)
                                {
                                    objWebinarRecurrBE.endType = "After";
                                    objWebinarRecurrBE.endValue = txtEndAfter.Text;
                                    if (!objUtil.IsInteger(txtEndAfter.Text.Trim()))
                                        rtnVal = "Number of recurrence should be numeric";
                                }
                                else
                                {
                                    objWebinarRecurrBE.endType = "Endby";
                                    objWebinarRecurrBE.endValue = Convert.ToDateTime(rdtEndBy.SelectedDate).ToShortDateString();
                                    if (!objUtil.isDateGreaterToday(Convert.ToDateTime(rdtEndBy.SelectedDate)))
                                        rtnVal = "End by date cannot be in past";
                                }
                                if (rtnVal == string.Empty)
                                {
                                    switch (rbtnDurationType.SelectedValue)
                                    {
                                        //case "H":
                                        //    recurrCond = "H:" + rcmbHourly.SelectedValue;
                                        //    break;
                                        case "D":
                                            recurrCond = "D:" + (rbtnEday.Checked ? "ED" + rcmbEDay.SelectedValue : "EW");
                                            break;
                                        case "W":
                                            string selWDay = "";
                                            foreach (ListItem li in chkWkDay.Items)
                                            {
                                                if (li.Selected)
                                                    selWDay = selWDay + li.Value + ",";
                                            }
                                            if (selWDay.Length > 0)
                                                recurrCond = "W:" + rcmbRecurE.SelectedValue + ":" + selWDay.Substring(0, selWDay.Length - 1);
                                            else
                                                recurrCond = "W:" + rcmbRecurE.SelectedValue + ":";
                                            break;
                                        case "M":
                                            if (optMDay.Checked)
                                                recurrCond = "M:D:" + rcmbMDay.SelectedValue + ":" + rcmbMDay1.SelectedValue;
                                            else
                                                recurrCond = "M:T:" + rcmbMTheDay.SelectedValue + ":" + rcmbMTheTyp.SelectedValue + ":" + rcmbM1.SelectedValue;
                                            break;
                                        case "Y":
                                            if (optY.Checked)
                                                recurrCond = "Y:E:" + rcmbY.SelectedValue + ":" + rcmbYMonthday.SelectedValue;
                                            else
                                                recurrCond = "Y:T:" + rcmbYTheDay.SelectedValue + ":" + rcmbYTheTyp.SelectedValue + ":" + rcmbMTheMonth.SelectedValue;
                                            break;
                                    }
                                    objWebinarRecurrBE.WebinarID = webinarID;
                                    objWebinarRecurrBE.recurrType = rbtnDurationType.SelectedValue;
                                    objWebinarRecurrBE.recurrCriteria = recurrCond;
                                }
                                //objWebinarDA.UpdateWebinarRecurrence(objWebinarRecurrBE);
                            }
                            #endregion

                            if ((Convert.ToDateTime(rdtStartDate.SelectedDate) - DateTime.Now).Days < 0)
                            {
                                rtnVal = "Cannot schedule webinar in the past";
                            }
                            else if ((Convert.ToDateTime(rdtStartDate.SelectedDate) - DateTime.Now).Days == 0)
                            {
                                UserDA objUserDA = new UserDA();
                                float tm = objUserDA.getTimezoneToServerTimeDiff(Convert.ToInt32(ddlTimeZone.SelectedValue));
                                DateTime currentClientPreferDateTime = DateTime.Now.AddHours(-tm);

                                if ((Convert.ToDateTime(rdtStartTime.SelectedDate) - Convert.ToDateTime(currentClientPreferDateTime)).Minutes < 0)
                                    rtnVal = "Cannot schedule webinar past the current time";
                            }

                            if (rtnVal == "")
                            {
                                if (objWebinarDA.IsWebinarOverlapping(objUtil.FormDBDate(Convert.ToDateTime(rdtStartDate.SelectedDate)), rdtStartTime.SelectedDate.ToString(), rdEndTime.SelectedDate.ToString(), Convert.ToInt32(Session["UserID"]), Convert.ToInt32(hWebinarID.Value)))
                                {
                                    rtnVal = objError.getMessage("WB0008");
                                }
                                else
                                {
                                    webinarID = objWebinarDA.SaveWebinarSchedule(objWebinarBE, objWebinarRecurrBE, Session["EmailID"].ToString());
                                    saveRecurrenceInstances(webinarID);
                                    if (hWebinarID.Value == "0") // this section occurs when new webinars get created
                                    {
                                        hWebinarID.Value = webinarID.ToString();
                                        //setWebinarIDToTabs(hWebinarID.Value, true);
                                        lblWebinarTitle.Text = "<b>Webinar Title</b> - " + txtWebinarTitle.Text;
                                        fvWebTitle.Visible = true;
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                    break;
                case 2:
                    if (hIsPast.Value == "0")
                    {
                        rtnVal = webRegistration1.saveRegistrationInfo();
                    }
                    break;
                case 3:
                    if (hIsPast.Value == "0")
                    {
                        webAudience1.saveAudienceComponent();
                    }
                    break;
                case 4:
                    if (hIsPast.Value == "0")
                    {
                        webEmail1.SaveWebEmail();
                    }
                    break;
            }
            if (rtnVal == string.Empty)
            {
                if (hWebinarID.Value != "0")
                {
                    if (tabCnt < 4)
                        tabCnt = tabCnt + 1;
                    hActiveTab.Value = tabCnt.ToString();
                    setTab();
                }
            }
            else
                lblError.Text = "<br>" + rtnVal;
        }
コード例 #3
0
ファイル: WebinarDA.cs プロジェクト: selva-osai/scheduler
        public int SaveWebinarSchedule(WebinarBE objWebinarBE, WebinarRecurrencyBE objWebRecurrenceBE, string UpdateToEmails)
        {
            int webinarID = objWebinarBE.WebinarID;
            string sql1 = "";
            bool isNew = true;
            if (webinarID == 0)
                sql1 = "spAddNewWebinar";
            else
            {
                sql1 = "spUpdateWebinar";
                isNew = false;
            }
            try
            {
                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {
                    MySqlCommand sqlCmd = new MySqlCommand(sql1, sqlCon);
                    sqlCon.Open();
                    sqlCmd.CommandType = CommandType.StoredProcedure;
                    sqlCmd.Parameters.Add(new MySqlParameter("pWebinarTitle", objWebinarBE.Title));
                    sqlCmd.Parameters.Add(new MySqlParameter("pDescription", objWebinarBE.Description));
                    sqlCmd.Parameters.Add(new MySqlParameter("pStartDate", objWebinarBE.StartDate.ToString("yyyy-MM-dd")));
                    sqlCmd.Parameters.Add(new MySqlParameter("pStartTime", Convert.ToDateTime(objWebinarBE.StartTime).ToString("HH:mm:ss")));
                    sqlCmd.Parameters.Add(new MySqlParameter("pEndTime", Convert.ToDateTime(objWebinarBE.EndTime).ToString("HH:mm:ss")));
                    sqlCmd.Parameters.Add(new MySqlParameter("pRecurrence", objWebinarBE.isRecurrence));
                    sqlCmd.Parameters.Add(new MySqlParameter("pTimeZoneID", objWebinarBE.TimeZoneID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pDeliveryChannel", objWebinarBE.DeliveryChannel));
                    sqlCmd.Parameters.Add(new MySqlParameter("pIsPublic", objWebinarBE.isPublic));
                    sqlCmd.Parameters.Add(new MySqlParameter("pIsPassRequired", objWebinarBE.isPasswordRequired));
                    sqlCmd.Parameters.Add(new MySqlParameter("pWebinarPassword", objWebinarBE.WebinarPassword));
                    sqlCmd.Parameters.Add(new MySqlParameter("pUpdateToEmails", UpdateToEmails));
                    if (webinarID == 0)
                    {
                        sqlCmd.Parameters.Add(new MySqlParameter("pCreatedBy", objWebinarBE.Createdby));
                    }
                    else
                    {
                        sqlCmd.Parameters.Add(new MySqlParameter("pModifiedBy", objWebinarBE.Modifiedby));
                        sqlCmd.Parameters.Add(new MySqlParameter("pWebinarID", objWebinarBE.WebinarID));
                    }
                    sqlCmd.Parameters.Add(new MySqlParameter("pRecurrType", objWebRecurrenceBE.recurrType));
                    sqlCmd.Parameters.Add(new MySqlParameter("pEndType", objWebRecurrenceBE.endType));
                    sqlCmd.Parameters.Add(new MySqlParameter("pEndValue", objWebRecurrenceBE.endValue));
                    sqlCmd.Parameters.Add(new MySqlParameter("pRecurrCriteria", objWebRecurrenceBE.recurrCriteria));

                    MySqlDataReader reader = sqlCmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        webinarID = reader["WebinarID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["WebinarID"]);
                    }
                    reader.Close();
                    reader = null;
                    if (isNew)
                    {
                        SaveWebinarURLs(webinarID);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return webinarID;
        }