public KeyValuePair <int, String> MasterReport_ChangeStatus(MasterReport model) { var param = new SqlParameter[] { new SqlParameter("@ReportID", SqlDbType.UniqueIdentifier) { Value = model.ReportID }, new SqlParameter("@UserUpdate", SqlDbType.UniqueIdentifier) { Value = model.ModifiedBy }, new SqlParameter("@RetVal", SqlDbType.Int) { Direction = ParameterDirection.Output }, new SqlParameter("@Message", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output } }; int rc = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("exec [CRM].[MasterReport_ChangeStatus] @ReportID, @UserUpdate, @RetVal OUTPUT, @Message OUTPUT", param); int retVal = (int)param[2].Value; string valueRes = param[3].Value.ToString(); return(new KeyValuePair <int, string>(retVal, valueRes)); }
public ActionResult Edit(Guid id) { MasterReport model = db.masterReport.Find(id); ViewBag.StatusLabel = model.Status == 1 ? "Active" : "Deactive"; return(View(model)); }
public void TestMasterRecordCRUD() { MasterReportDto dto = new MasterReportDto(MasterReportDto.TransientId, new List<MasterQuestionnaireDto>(), "", DateTime.Now, new List<Pair<PageElementType, string>>(), ""); MasterReportDto persDto = FormRegistry.MasterReportDao.Create(dto); Assert.AreNotEqual(0, persDto.MasterRptId); _createdMasterReports.Add(persDto.MasterRptId); List<MasterReportDto> list = FormRegistry.MasterReportDao.GetMasterReports(null, null, null, null, "ad"); Assert.IsNotNull(list); Assert.Less(0, list.Count); MasterReportDto persDto2 = list.Find(delegate(MasterReportDto cur) { return cur.MasterRptId == persDto.MasterRptId; }); Assert.IsNotNull(persDto2); Assert.IsFalse(dto.Equals(persDto2, false)); MasterReport mr = new MasterReport(persDto); MasterQuestionnaireDto mq = new MasterQuestionnaireDto(_currentQuestionnaire.QuestionnaireId, _currentQuestionnaire.QidTitle, _currentCampaign.CampaignCode, DateTime.Today, DateTime.Today, "*****@*****.**"); mr.AddSchQuestionnaire(mq); mr.Save(); MasterReport mr2 = new MasterReport(persDto2); //Assert.IsTrue(mr2.ValidateMaster()); List<MasterQuestionnaireDto> mqs = MasterReport.GetMasterQuestions(mr2.Dto.MasterRptId); if(mqs.Count > 0) Assert.Less(0 , mqs.Count); else Assert.IsEmpty(mqs); if(mqs.Count > 0) Assert.IsTrue(mqs.Exists(delegate(MasterQuestionnaireDto cur) { return cur.QId == mq.QId; })); else Assert.IsFalse(mqs.Exists(delegate(MasterQuestionnaireDto cur) { return cur.QId == mq.QId; })); FormRegistry.QuestionnaireDao.Delete(mq.QId, TestUser); _createdQuestionnaires.Remove(mq.QId); mqs = MasterReport.GetMasterQuestions(mr2.Dto.MasterRptId); Assert.IsNotNull(mqs); Assert.AreEqual(0, mqs.Count); FormRegistry.MasterReportDao.DeleteMasterReport(persDto.MasterRptId); _createdMasterReports.Remove(persDto.MasterRptId); list = FormRegistry.MasterReportDao.GetMasterReports(null, null, null, null, "ad"); Assert.IsNotNull(list); persDto = list.Find(delegate(MasterReportDto cur) { return cur.MasterRptId == persDto2.MasterRptId; }); Assert.IsNull(persDto); }
public void TestAdd3QuesitonnairesAndGetBack() { QuestionnaireDto q1 = SetupQuestionnaireForMasterReport(Q1Elements); QuestionnaireDto q2 = SetupQuestionnaireForMasterReport(Q1Elements); QuestionnaireDto q3 = SetupQuestionnaireForMasterReport(Q1Elements); MasterReport mrp = new MasterReport(TestUser); //create report mrp.CreateMasterReport("master name", TestUser, Migration.Convert(ScheduleMode.Daily), 0, DateTime.Today.AddDays(-1), DateTime.Today.AddDays(1), true, q1.QuestionnaireId); FormRegistry.MasterReportDao.AddQuestionnaireToReport(mrp.Dto.MasterRptId, q1.QuestionnaireId); Assert.IsFalse(mrp.ValidateMaster()); mrp.Save(); Assert.Less(0, mrp.Dto.MasterRptId); _createdMasterReports.Add(mrp.Dto.MasterRptId); //check read List<MasterReportDto> list = FormRegistry.MasterReportDao.GetMasterReports(true, 0, null, null, "ad"); Assert.IsNotNull(list); MasterReportDto mine = list.Find(delegate(MasterReportDto cur) { return cur.MasterRptId == mrp.Dto.MasterRptId; }); Assert.IsNotNull(mine); MasterReport mrpSel = new MasterReport(mine); mrpSel.Dto.MasterQ = MasterReport.GetMasterQuestions(mrpSel.Dto.MasterRptId); Assert.IsNotNull(mrpSel.Dto.MasterQ); if (mrpSel.Dto.MasterQ.Count > 0) Assert.AreEqual(1, mrpSel.Dto.MasterQ.Count); else Assert.AreEqual(0, mrpSel.Dto.MasterQ.Count); if (mrpSel.Dto.MasterQ.Count > 0) Assert.AreEqual(q1.QuestionnaireId, mrpSel.Dto.MasterQ[0].QId); else Assert.AreNotEqual(q1.QuestionnaireId, mrpSel.Dto.MasterQ[0].QId); //add others //mrpSel.AddSchQuestionaire }
public ActionResult Create(MasterReport model) { return(formSubmit(model, "Create")); }
public ActionResult Create() { MasterReport model = new MasterReport(); return(View(model)); }
protected void AddMasterQ_Click(object sender, System.EventArgs e) { if (end_date.SelectedIndex != 0) { if (Session["Master"] == null) { MasterReport master = new MasterReport(permss.EmailAddress); Session["Master"]=master; Session["IsMasterReport"] = true; } int qid; int.TryParse(questionnaires_list.SelectedValue,out qid); #region convert dates int s_year = Int32.Parse(start_date.SelectedItem.Text.Split('/')[2]); int s_month = Int32.Parse(start_date.SelectedItem.Text.Split('/')[1]); int s_day = Int32.Parse(start_date.SelectedItem.Text.Split('/')[0]); int e_year = Int32.Parse(end_date.SelectedItem.Text.Split('/')[2]); int e_month = Int32.Parse(end_date.SelectedItem.Text.Split('/')[1]); int e_day = Int32.Parse(end_date.SelectedItem.Text.Split('/')[0]); from = new DateTime(s_year, s_month, s_day, 0, 0, 0); //TODO Susann change to also recognize responses received after (milliseconds) 23:59:59,000 //until = new DateTime(e_year, e_month, e_day, 23, 59, 59); until = new DateTime(e_year, e_month, e_day, 0, 0, 0); until = until.AddDays(1d); #endregion MasterQuestionnaireDto Mq = new MasterQuestionnaireDto(qid, ViewState["questionnaire_title"].ToString(), campaign_list.SelectedValue, from, until,count_responses_time.Text.ToString()); string errMsg = ""; MasterReport mrd = (MasterReport)Session["Master"]; errMsg= mrd.AddQuestionnaire(Mq); lbl1.Text = string.IsNullOrEmpty(errMsg)?null:errMsg; //add to datalist System.Collections.Generic.Dictionary<string, string> dct = new System.Collections.Generic.Dictionary<string, string>(); foreach (Pair<PageElementType, string> element in mrd.Dto.MElementHeading) { dct.Add(Migration.Convert(element.First), element.Second); } if (mrd.Dto.MElementHeading.Count > 0) { dtl1.DataSource =dct; dtl1.DataBind(); } else { lbl2.Text = "No Dynamic Questions exists for this Questionnaire."; } dg1.DataSource = mrd.Dto.MasterQ;//TODO: 1.9.6 masterreport this might cause problems dg1.DataBind(); pnlQuest.Visible = true; } }
public ActionResult Delete(MasterReport model) { return(formSubmit(model, "Delete")); }
private void saveMasterSch() { mrd = mrd_local; #region custom validate bool isValid = true; bool isweekly = false; #region master name cnt be null if (mName.Text == "") { isValid = false; lbl0.ForeColor = Color.Red; lbl0.Text = "<b>Master Name cannot be empty</b>"; } #endregion #region check if a schedule mode is selected if (schedule_mode.SelectedIndex == 0) { isValid = isValid & false; error_mode.Visible = true; error_day.Visible = false; } else { error_mode.Visible = false; if (schedule_mode.SelectedItem.Value == "w") { isweekly = true; if (schedule_day.SelectedIndex == 0) { isValid = isValid & false; error_day.Visible = true; } else { error_day.Visible = false; } } } #endregion #region check if schedule_recipient is correct if used string schedule_recipient = ""; string tb_recipient_input = tb_recipient.Text.Trim(); if (permss.UserType == UserType.Admin) { if (tb_recipient_input.Length != 0 && dd_possible_users.SelectedIndex != 0) { //which recipient has to be set?? isValid = isValid & false; lb_email_error_tworecipients.Visible = true; } else { if (tb_recipient_input.Length != 0) { //validate that recipient(s) is/are HP/EDS-email_address(es) if (!Check_email_entries(tb_recipient_input)) //if (!tb_recipient_input.EndsWith("@hp.com")) { //show error isValid = isValid & false; //lb_email_error_nonhp.Visible = true; } else { //check if user is already an RFG user, but doesn't have the permission... ListItem found_user = dd_possible_users.Items.FindByText(tb_recipient_input); if (found_user != null) { //everything is almost fine but exchange the values... schedule_recipient = tb_recipient_input; tb_recipient.Text = ""; dd_possible_users.SelectedItem.Selected = false; found_user.Selected = true; } else { //ask database Hashtable h_params = new Hashtable(); h_params.Add("useremail", tb_recipient_input); DataTable existing_user = DB.execProc("select_user", h_params); if (existing_user.Rows.Count != 0) { //user doesn't have the correct permissions for this questionnaire isValid = isValid & false; lb_email_error_nopermission.Visible = true; } else { //user doesn't exist schedule_recipient = tb_recipient_input; } } } } if (dd_possible_users.SelectedIndex != 0) { schedule_recipient = dd_possible_users.SelectedItem.Text; } } } #endregion #endregion //string schedule_id = ""; if (isValid) { if (schedule_recipient.Length == 0) { schedule_recipient = permss.EmailAddress; } Hashtable h_params = new Hashtable(); if (mrd != null) { //h_params.Add("master_id", ).Dto.MasterRptId); mrd.Dto.MasterName = mName.Text.TrimStart(' ').TrimEnd(' ').ToString(); //update of recipient is only allowed for admins if (permss.UserType == UserType.Admin) { mrd.Dto.RecipientEmail = schedule_recipient; } //} mrd.Dto.ScheduleMode = Migration.ConvertToScheduleMode(schedule_mode.SelectedItem.Value); if (isweekly) { int scheduleDay = 0; if (int.TryParse(schedule_day.SelectedItem.Value, out scheduleDay)) { mrd.Dto.ScheduleDay = scheduleDay; } } mrd.Save(); Response.Redirect("index_scheduled_Masterexports.aspx"); } } }
protected void UpdateHeading_Click(object sender, System.EventArgs e) { Hashtable tmp = new Hashtable(); //bool cnt = true; //string val = ""; List<Pair<PageElementType, string>> headings = new List<Pair<PageElementType, string>>(); foreach (DataGridItem dgm in dtl1.Items) { string updVal = ((TextBox)dgm.Cells[2].Controls[1]).Text; if (updVal == "") updVal = dgm.Cells[1].Text; //val = string.Format("{1}:{2}|{0}", val, dgm.Cells[0].Text, updVal); headings.Add(new Pair<PageElementType, string>(Migration.Convert(dgm.Cells[0].Text), updVal)); } //string values = Request.Params["__EVENTARGUMENT"].ToString().TrimEnd(' ').ToString(); if (headings.Count > 0) { if (mrd != null) { mrd.Dto.MElementHeading = headings;// SetHeadings(val); /*mrd.Dto.IsCustomHeading = true;*/ //Hashtable h_params = new Hashtable(); //h_params.Add("master_id", mrd.Dto.MasterRptId); //h_params.Add("master_element_types", mrd.Dto.MElementType); //h_params.Add("master_element_headings", val.TrimEnd('|').ToString()); //DB.execProc("update_masterreport", h_params); mrd.Save(); dtl1.DataSource = mrd.Dto.MElementHeading; dtl1.DataBind(); mrd_local = mrd; } } }
private void Page_Load_new() { // Put user code to initialize the page here string errMsg = string.Empty; string titl = exp ? "Create a new scheduled export of master report" : "Create a new export of master report"; page_utilities.Set_titles(this, titl); choose_table = new DataTable(); choose_table.Columns.Add("rdate"); choose_table.Columns.Add("country_language"); DataRow add_row = choose_table.NewRow(); add_row["country_language"] = "-- Please choose... --"; add_row["rdate"] = "-- Please choose... --"; choose_table.Rows.InsertAt(add_row, 0); lb_email_error_invalid.Visible = false; lb_email_error_nonhp.Visible = false; lb_email_error_nopermission.Visible = false; lb_email_error_tworecipients.Visible = false; #region if admin then schedule can be set on behalf admin_behalf.Visible = (permss.UserType == UserType.Admin); #endregion //madan added for the quesionaire visible if (exp) campaign_list.Enabled = (schedule_mode.SelectedIndex <= 0) ? false : true; if (!this.IsPostBack) { #region display inactive please choose for questionnaire questionnaires_list.DataSource = choose_table; questionnaires_list.DataValueField = "rdate"; questionnaires_list.DataBind(); #endregion #region display inactive please choose for possible_users if (permss.UserType == UserType.Admin) { dd_possible_users.Items.Add("-- Please choose... --"); dd_possible_users.DataBind(); } #endregion #region load campaigns string countriesQ = null; string countriesP = null; if (permss.UserType == UserType.CountryUserWithDataAccess) { countriesQ = String.Empty; countriesP = String.Empty; if (permss.ListOfPermitedCountriesQuestionnaire != null && permss.ListOfPermitedCountriesQuestionnaire.Count > 0) { for (int i = 0; i < permss.ListOfPermitedCountriesQuestionnaire.Count; i++) { if (i != 0) { countriesQ += ","; } countriesQ += permss.ListOfPermitedCountriesQuestionnaire[i].Country; } } if (permss.ListOfPermitedCountriesProcessor != null && permss.ListOfPermitedCountriesProcessor.Count > 0) { for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++) { if (i != 0) { countriesP += ","; } countriesP += permss.ListOfPermitedCountriesProcessor[i].Country; } } } //don't show empty campaigns (campaigns without any questionnaire) List<CampaignDto> listOfCampaigns = new List<CampaignDto>(); listOfCampaigns.Add(new CampaignDto() { CampaignCode = "-- Please choose... --" }); List<CampaignDto> tempCamp = CampaignFacade.SelectCampaignsByCodeCountriesTypeAndIndicatorIfEmpty(null, countriesQ, countriesP, 0); if (tempCamp != null && tempCamp.Count > 0) listOfCampaigns.AddRange(tempCamp); campaign_list.DataSource = listOfCampaigns; campaign_list.DataValueField = "CampaignCode"; campaign_list.DataBind(); campaign_list.Items[0].Selected = true; #endregion } if (dg1 != null) { for (int i = 0; i < dg1.Items.Count; i++) { if (i == 0) { if (mrd == null) { if (createMasterReportNew()) { if (mrd != null) { MasterQuestionnaireDto mq = new MasterQuestionnaireDto(); mq.QId = Convert.ToInt32(dg1.Items[i].Cells[1].Text.ToString()); mq.CName = dg1.Items[i].Cells[2].Text.ToString(); mq.QName = dg1.Items[i].Cells[3].Text.ToString(); errMsg = mrd.AddSchQuestionnaire(mq); } } } } else { if (mrd != null) { MasterQuestionnaireDto mq = new MasterQuestionnaireDto(); mq.QId = Convert.ToInt32(dg1.Items[i].Cells[1].Text.ToString()); mq.CName = dg1.Items[i].Cells[2].Text.ToString(); mq.QName = dg1.Items[i].Cells[3].Text.ToString(); errMsg = mrd.AddSchQuestionnaire(mq); } } } } if (!IsPostBack) mrd_local = mrd; }
private void Page_Load_edit() { // Put user code to initialize the page here string e_ttl = exp ? "Edit a scheduled export of master report" : "Edit an export of master report"; page_utilities.Set_titles(this, e_ttl); //string mid = string.Empty; //if (Request.QueryString["mid"] != null) //{ // mid = Request.QueryString["mid"].ToString(); //} index_MasterReport MasterrptNow = null; if (!IsPostBack) { if (Context.Handler.GetType().Name.Equals("datamgmt_index_masterreport_aspx")) { if ((index_MasterReport)Context.Handler != null) { MasterrptNow = (index_MasterReport)Context.Handler; MaterRptId.Value = Convert.ToString(MasterrptNow.MstrId); } } } Hashtable h_masterparams = new Hashtable(); string countriesQ = null; string countriesP = null; if (permss.UserType != UserType.Admin) { countriesQ = String.Empty; countriesP = String.Empty; if (permss.ListOfPermitedCountriesQuestionnaire != null && permss.ListOfPermitedCountriesQuestionnaire.Count > 0) { for (int i = 0; i < permss.ListOfPermitedCountriesQuestionnaire.Count; i++) { if (i != 0) { countriesQ += ","; } countriesQ += permss.ListOfPermitedCountriesQuestionnaire[i].Country; } } if (permss.ListOfPermitedCountriesProcessor != null && permss.ListOfPermitedCountriesProcessor.Count > 0) { for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++) { if (i != 0) { countriesP += ","; } countriesP += permss.ListOfPermitedCountriesProcessor[i].Country; } } } h_masterparams.Add("type", Migration.ConvertUserTypeToString(permss.UserType)); h_masterparams.Add("countriesQ", countriesQ); h_masterparams.Add("countriesP", countriesP); DataTable MasterReportNames = DB.execProc("select_masterreports", h_masterparams); DataRow[] MasterName = null; Int32 Masterrpt_id = 0; if (MasterReportNames != null) { if (MasterReportNames.Rows.Count > 0) { if (int.TryParse(MaterRptId.Value, out Masterrpt_id)) MasterName = MasterReportNames.Select("master_id = '" + Masterrpt_id + "'"); } } if (MasterName.ToString().Trim().Length > 0) { mrd = new MasterReport(permss.EmailAddress); mrd.Dto.MasterRptId = int.Parse(MasterName[0]["master_id"].ToString()); mrd.Dto.MasterName = MasterName[0]["master_name"].ToString(); mrd.SetHeadings(MasterName[0]["master_element_headings"].ToString()); mrd.Dto.MElementType = MasterName[0]["master_element_types"].ToString(); mrd.Dto.Creator = MasterName[0]["creator"].ToString(); mrd.Dto.RecipientEmail = MasterName[0]["recipient_email"].ToString(); mrd.Dto.ScheduleMode = Migration.ConvertToScheduleMode(MasterName[0]["schedule_mode"].ToString()); int scheduleDay = 0; if (int.TryParse(MasterName[0]["schedule_day"].ToString(), out scheduleDay)) { mrd.Dto.ScheduleDay = scheduleDay; } else { mrd.Dto.ScheduleDay = null; } mrd.Dto.IsScheduled = Convert.ToBoolean(MasterName[0]["isScheduled"].ToString()); if (!IsPostBack) { mName.Text = mrd.Dto.MasterName.Trim(); savemasterreport.Checked = true; } //attach questions mrd.Dto.MasterQ = MasterReport.GetMasterQuestions(mrd.Dto.MasterRptId); if (mrd.Dto.MasterQ.Count > 0) { //bind heading if (!IsPostBack) { if (mrd.Dto.MElementHeading.Count > 0) { dtl1.DataSource = mrd.Dto.MElementHeading; dtl1.DataBind(); } else { lbl2.Text = "No variable column exists for this Questionnaire/s."; }//btnUpdHd.Enabled = false; } } //bind ques if (!IsPostBack) { dg1.DataSource = mrd.Dto.MasterQ; dg1.DataBind(); } pnlQuest.Visible = true; pnlTimeFrame.Visible = true; } if (exp) { schedule_mode.Items.FindByValue(mrd.Dto.ScheduleMode.ToString()).Selected = true; if (schedule_mode.SelectedItem.Value == "w") { schedule_day.Enabled = true; schedule_day.SelectedItem.Selected = false; schedule_day.Items.FindByValue(mrd.Dto.ScheduleDay.ToString()).Selected = true; } #region load recepient if (permss.UserType == UserType.Admin) { admin_behalf.Visible = true; dd_possible_users.Enabled = true; #region load dd_user and select if possible Hashtable h_params = new Hashtable(); h_params.Add("masterID", Masterrpt_id); DataTable DtFinalUsers = DB.execProc("select_users_permitted_for_masterreport", h_params); dd_possible_users.DataSource = DtFinalUsers; dd_possible_users.DataTextField = "useremail"; DataRow addingRow; addingRow = DtFinalUsers.NewRow(); addingRow["useremail"] = "-- Please choose... --"; DtFinalUsers.Rows.InsertAt(addingRow, 0); dd_possible_users.DataBind(); string recipient = string.Empty; ListItem found_user = dd_possible_users.Items.FindByText(recipient); if (found_user != null) { dd_possible_users.SelectedItem.Selected = false; found_user.Selected = true; } else { tb_recipient.Text = recipient; } #endregion } } #endregion if (!IsPostBack) { #region load campaigns List<CampaignDto> listOfCampaigns = new List<CampaignDto>(); listOfCampaigns.Add(new CampaignDto() { CampaignCode = "-- Please choose... --" }); List<CampaignDto> tempCamp = CampaignFacade.SelectCampaignsByCodeCountriesTypeAndIndicatorIfEmpty(null, countriesQ, countriesP, 0); if (tempCamp != null && tempCamp.Count > 0) listOfCampaigns.AddRange(tempCamp); campaign_list.DataSource = listOfCampaigns; campaign_list.DataValueField = "CampaignCode"; campaign_list.DataBind(); campaign_list.Items[0].Selected = true; #endregion } } if (!IsPostBack) mrd_local = mrd; }
private bool CrtMasterNow() { bool isValid = true; mrd = new MasterReport(permss.EmailAddress); int qid; int.TryParse(questionnaires_list.SelectedValue, out qid); mrd.CreateMasterReport("", permss.EmailAddress, "", 7, DateTime.Today.AddDays(-1), DateTime.Today.AddDays(1), exp, qid); mrd_local = mrd; return isValid; }
private bool CrtMasterSch() { bool isValid = true; if (mName.Text != String.Empty && questionnaires_list.SelectedIndex > 0 && (dd_possible_users.SelectedIndex > 0 || tb_recipient.Text != String.Empty)) { #region custom validate bool isweekly = false; string schedule_recipient = String.Empty; #region check if a schedule mode is selected if (schedule_mode.SelectedIndex == 0) { isValid = isValid & false; error_mode.Visible = true; error_day.Visible = false; } else { error_mode.Visible = false; if (schedule_mode.SelectedItem.Value == "w") { isweekly = true; if (schedule_day.SelectedIndex == 0) { isValid = isValid & false; error_day.Visible = true; } else { error_day.Visible = false; } } } #endregion #region check if schedule_recipient is correct if used string tb_recipient_input = tb_recipient.Text.Trim(); if (permss.UserType == UserType.Admin) { if (tb_recipient_input.Length != 0 && dd_possible_users.SelectedIndex != 0) { //which recipient has to be set?? isValid = isValid & false; lb_email_error_tworecipients.Visible = true; } else { if (tb_recipient_input.Length != 0) { //validate that recipient(s) is/are HP/EDS-email_address(es) if (!Check_email_entries(tb_recipient_input)) //if (!tb_recipient_input.EndsWith("@hp.com")) { //show error isValid = isValid & false; //lb_email_error_nonhp.Visible = true; } else { //check if user is already an RFG user, but doesn't have the permission... ListItem found_user = dd_possible_users.Items.FindByText(tb_recipient_input); if (found_user != null) { //everything is almost fine but exchange the values... schedule_recipient = tb_recipient_input; tb_recipient.Text = ""; dd_possible_users.SelectedItem.Selected = false; found_user.Selected = true; } else { //ask database Hashtable h_params = new Hashtable(); h_params.Add("useremail", tb_recipient_input); DataTable existing_user = DB.execProc("select_user", h_params); if (existing_user.Rows.Count != 0) { //user doesn't have the correct permissions for this questionnaire isValid = isValid & false; lb_email_error_nopermission.Visible = true; } else { //user doesn't exist schedule_recipient = tb_recipient_input; } } } } if (dd_possible_users.SelectedIndex != 0) { schedule_recipient = dd_possible_users.SelectedItem.Text; } } } #endregion #endregion if (isValid) { MasterReport master = new MasterReport(permss.EmailAddress); mName.Text = mName.Text.TrimStart(' ').TrimEnd(' '); int scday = 7; scday = isweekly ? int.Parse(schedule_day.SelectedItem.Value) : scday; int qid; int.TryParse(questionnaires_list.SelectedValue, out qid); DateTime frm = new DateTime(), to = new DateTime(); if (!exp) { DateTime.TryParse(mFrom.Text, out frm); DateTime.TryParse(mUntil.Text, out to); //TODO Susann to change to also recognize responses received after (milliseconds) 23:59:59,000 //to.AddHours(23).AddMinutes(59).AddSeconds(59); to.AddDays(1d); } master.CreateMasterReport(mName.Text, schedule_recipient, schedule_mode.SelectedItem.Value, scday, DateTime.Today.AddDays(-1), DateTime.Today.AddDays(1), exp, qid); } } else { isValid = false; string errMsg = "Please enter "; errMsg = mName.Text != "" ? errMsg : errMsg + "Master Name "; errMsg = questionnaires_list.SelectedIndex > 0 ? errMsg : errMsg + "select a Questionnaire "; errMsg = (dd_possible_users.SelectedIndex > 0 || tb_recipient.Text != "") ? errMsg : errMsg + "enter recipient email"; lbl1.ForeColor = Color.Red; lbl1.Text = "<b>" + errMsg + "</b>"; } mrd_local = mrd; return isValid; }
public ActionResult Edit(MasterReport model) { return(formSubmit(model, "Edit")); }
private void saveMasterNow() { mrd = mrd_local; bool isValid = true; lbl1.Text = string.Empty; lbl2.Text = string.Empty; lbl0.Text = string.Empty; lbl4.Text = string.Empty; if ((!savemasterreport.Checked) && (!extractnow.Checked)) { isValid = false; lbl0.ForeColor = Color.Red; lbl0.Text = "Either Save Master Report or Extact Report Now should be selected !"; } #region master name cnt be null if (isValid) if ((savemasterreport.Checked) && (mName.Text.Trim() == string.Empty)) { isValid = false; lbl0.ForeColor = Color.Red; string msg = string.IsNullOrEmpty(mName.Text.Trim()) ? "Master Name" : ""; lbl0.Text = string.Format("<b>{0} cannot be empty</b>", msg.TrimStart(',')); } else if ((savemasterreport.Checked) && (mName.Text.Trim() != string.Empty) && content == "new") { #region Validation for Same Master report name Hashtable h_params = new Hashtable(); h_params.Add("MasterName", mName.Text.Trim()); DataTable MasterReportNames = DB.execProc("select_masterreportname", h_params); if (MasterReportNames.Rows.Count != 0) { isValid = false; lbl0.ForeColor = Color.Red; lbl0.Text = string.Format("<b>Master Report Name already Exists</b>"); } #endregion } #endregion if (isValid) if (dg1.Items.Count < 1) { isValid = false; lbl1.ForeColor = Color.Red; lbl1.Text = "Please add a Questionnaire. "; } if (isValid) { foreach (DataGridItem dgm in dtl1.Items) { string updVal = ((TextBox)dgm.Cells[2].Controls[1]).Text.Trim(); if (updVal == "") { isValid = false; break; } } if (!isValid) { lbl2.ForeColor = Color.Red; lbl2.Text = "Captions cannot be Empty !"; } } if (isValid) if ((extractnow.Checked) && ((mFrom.Text == "") || (mUntil.Text == ""))) { isValid = false; lbl4.ForeColor = Color.Red; string msg = string.IsNullOrEmpty(mFrom.Text.Trim()) ? "From Date" : ""; msg = string.IsNullOrEmpty(mUntil.Text.Trim()) ? msg + ",Until Date" : msg; lbl4.Text = string.Format("<b>{0} cannot be empty</b>", msg.TrimStart(',')); } if ((isValid) && (extractnow.Checked)) isValid = validateDate(mFrom.Text, mUntil.Text); if (isValid) { if (savemasterreport.Checked) { List<Pair<PageElementType, string>> headings = new List<Pair<PageElementType, string>>(); foreach (DataGridItem dgm in dtl1.Items) { string updVal = ((TextBox)dgm.Cells[2].Controls[1]).Text.Trim(); if (updVal == "") updVal = dgm.Cells[1].Text; //val = string.Format("{1}:{2}|{0}", val, dgm.Cells[0].Text, updVal); string PageElement = Migration.ConvertElement(dgm.Cells[1].Text); headings.Add(new Pair<PageElementType, string>(Migration.Convert(PageElement), updVal)); } if (mrd != null) { Hashtable h_params = new Hashtable(); DateTime frm, to; bool frmParseSuccess = DateTime.TryParse(mFrom.Text, out frm); bool untilParseSuccess = DateTime.TryParse(mUntil.Text, out to); //TODO Susann change to also recognize responses received after (milliseconds) 23:59:59,000 //to = to.AddHours(23).AddMinutes(59).AddSeconds(59); to = to.AddDays(1d); mrd.Dto.MasterName = mName.Text.TrimStart(' ').TrimEnd(' ').ToString(); //mrd.Dto.ScheduleMode = ScheduleMode.None;// h_params.Add("schedule_mode", ""); //if (DateTime.TryParse(mFrom.Text, out frm)) if (frmParseSuccess) mrd.Dto.From = frm;//h_params.Add("from", frm); else mrd.Dto.From = null; //checked for duplicate code because to was overwritten here again //if (DateTime.TryParse(mUntil.Text, out to)) if (untilParseSuccess) //TODO Susann to change to also recognize responses received after (milliseconds) 23:59:59,000 //TODO Susann check if overwriting ever worked or did result in wrong date anyway mrd.Dto.To = to;// h_params.Add("to", to); else mrd.Dto.To = null; //h_params.Add("schedule_day", 7); mrd.Dto.MElementHeading = headings;// SetHeadings(val); mrd.Save(); for (int i = 0; i < dg1.Items.Count; i++) { FormRegistry.MasterReportDao.AddQuestionnaireToReport(mrd.Dto.MasterRptId, Convert.ToInt32(dg1.Items[i].Cells[1].Text)); } } } if (extractnow.Checked) { if (!mrd.ValidateMaster()) { #region convert dates DateTime from = Convert.ToDateTime(mFrom.Text); DateTime until = Convert.ToDateTime(mUntil.Text); //TODO Susann to change to also recognize responses received after (milliseconds) 23:59:59,000 //until = until.AddHours(23).AddMinutes(59).AddSeconds(59); until = until.AddDays(1d); #endregion List<Pair<PageElementType, string>> headings = new List<Pair<PageElementType, string>>(); foreach (DataGridItem dgm in dtl1.Items) { string updVal = ((TextBox)dgm.Cells[2].Controls[1]).Text; if (updVal == "") updVal = dgm.Cells[1].Text; //val = string.Format("{1}:{2}|{0}", val, dgm.Cells[0].Text, updVal); string PageElement = Migration.ConvertElement(dgm.Cells[1].Text); headings.Add(new Pair<PageElementType, string>(Migration.Convert(PageElement), updVal)); } mrd.Dto.MElementHeading = headings;// SetHeadings(val); mrd.Dto.From = from; mrd.Dto.To = until; string QuestionnaireID = ""; for (int i = 0; i < dg1.Items.Count; i++) { QuestionnaireID = QuestionnaireID + dg1.Items[i].Cells[1].Text + ","; } _qid = QuestionnaireID.Substring(0, (QuestionnaireID.Length - 1)); Server.Transfer("process_response_email.aspx"); // } } else SendFailuremail(); } Response.Redirect("index_MasterReport.aspx"); //else //{ // Response.Redirect("index_MasterReport.aspx"); //} } else { //isValid = false; //lbl1.ForeColor = Color.Red; //lbl1.Text = "unable to find master report"; } }
public ActionResult ChangeStatus(MasterReport model) { return(formSubmit(model, "ChangeStatus")); }
private void SendNow(MasterReport mrd) { if (mrd.ValidateMaster()) { mrd.Dto.MasterQ = MasterReport.GetMasterQuestions(mrd.Dto.MasterRptId); Session["IsMasterReport"] = true; this.Response.Redirect("process_response_email.aspx"); } else { Session.Remove("MasterSch"); sndMsg.Text = string.Format("there is a configuration error for the below master report you should receive. Due to this error a report can not be generated.<br><span class=head>Please get in touch with {0} in order to fix the configuration error.", mrd.Dto.Creator); } }
public ActionResult formSubmit(MasterReport model, string actionType) { List <string> errorMessage = new List <string>(); string successMessage = Resources.NotifResource.DataSuccess; SessionForSP sessionParam = new SessionForSP(); sessionParam.CurrentUserID = new Guid(Session["CurrentUserID"].ToString()); if (ModelState.IsValid) { KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, ""); model.ModifiedBy = new Guid(Session["CurrentUserID"].ToString()); if (actionType == "Create") { model.ReportID = Guid.NewGuid(); results = db.MasterReport_Insert(model); } else if (actionType == "Edit") { results = db.MasterReport_Update(model); } else if (actionType == "ChangeStatus") { results = db.MasterReport_ChangeStatus(model); } else if (actionType == "Delete") { results = db.MasterReport_Delete(model); } if (results.Key == 0 || results.Key == 16 || results.Key == 6) { UrlHelper u = new UrlHelper(this.ControllerContext.RequestContext); string url = u.Action("Edit", "MasterReport", new { id = model.ReportID, success = successMessage }); string urlNew = u.Action("Create", "MasterReport"); var jsonData = new { flag = true, Message = url, urlNew = urlNew }; return(Json(jsonData)); } else { var jsonData = new { flag = false, Message = results.Value.ToString() }; return(Json(jsonData)); } } else { foreach (var key in ModelState.Keys) { var error = ModelState[key].Errors.FirstOrDefault(); if (error != null) { errorMessage.Add(error.ErrorMessage); } } var jsonData = new { flag = false, Message = errorMessage.First() }; return(Json(jsonData)); } }
private void SendNow(MasterReport mrd) { mrd.Dto.MasterQ = MasterReport.GetMasterQuestions(mrd.Dto.MasterRptId); if (!mrd.ValidateMaster()) { List<MasterQuestionnaireDto> lst = new List<MasterQuestionnaireDto>(); lst = FormRegistry.MasterReportDao.GetMasterQuestionnaires(mrd.Dto.MasterRptId); string Questionnaire_ID=""; for (int i = 0; i < lst.Count; i++) { Questionnaire_ID = Questionnaire_ID + lst[i].QId.ToString() + ","; } _qid = Questionnaire_ID.Substring(0, (Questionnaire_ID.Length - 1)); DateTime from = Convert.ToDateTime(mFrom.Text); DateTime until = Convert.ToDateTime(mUntil.Text); //TODO Susann change to also recognize responses received after (milliseconds) 23:59:59,000 //until = until.AddHours(23).AddMinutes(59).AddSeconds(59); until = until.AddDays(1d); mrd.Dto.From = from; mrd.Dto.To = until; //Fill the updated headings from Master Report string mstRptHeadings = FormRegistry.MasterReportDao.GetMasterElementHeadings(mrd.Dto.MasterRptId); if (!string.IsNullOrEmpty(mstRptHeadings)) mrd.SetHeadings(mstRptHeadings); Server.Transfer("process_response_email.aspx"); } else { #region create and send email MailMessage msg = new MailMessage(); //.NET 1.1: msg.BodyFormat = MailFormat.Html; msg.IsBodyHtml = true; //.NET 1.1: msg.From = email_from; msg.From = new MailAddress(utility.getParameter("email_sender")); //.NET 1.1: msg.To = report_params.permss_user; //MailAddressCollection to = msg.To; utility.set_Mail_address(ref msg, "to", mrd.Dto.Creator); //to.Add(report_params.permss_user); msg.Subject = String.Format("RFG - FAILURE - combined response file report for master report {0}", mrd.Dto.MasterName); #region building emails content (information about the responsefiles) string mail_text = @" <style> body {font-family:""Arial"";font-weight:normal;font-size:10pt;color:black;} table {font-family:""Arial"";font-weight:normal;font-size:10pt;color:black;} p {font-family:""Arial"";font-weight:normal;color:black;margin-top: -5px} b {font-family:""Arial"";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:""Arial"";font-weight:normal;font-size:14pt;color:black } H2 { font-family:""Arial"";font-weight:normal;font-size:10pt;color:maroon } H3 { font-family:""Arial"";font-weight:normal;font-size:10pt;color:darkgreen } pre {font-family:""Arial Console"";font-size: .9em} .head{ font-family:""Arial"";font-weight:bold;font-size:10pt;color:red } .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style>"; mail_text = String.Format("{0}<span><p>Hello {1},<br><br>", mail_text, mrd.Dto.Creator); string txt = "there is a configuration error for the below master report you should receive. Due to this error a report can not be generated.<br><span class=head>Please get in touch with {1} in order to fix the configuration error.</span><br><br><table border=1>"; mail_text = String.Format("{0}" + txt, mail_text, mrd.Dto.Creator.ToString()); if (mrd.Dto.MasterRptId > 1) mail_text = String.Format("{0}<tr><td width=100>Master Report Name:</td><td><b>{1}(mid = {2})</b> </td></tr>", mail_text, mrd.Dto.MasterName, mrd.Dto.MasterRptId.ToString()); else mail_text = String.Format("{0}<tr><td width=100>Master Report Name:</td><td><b>{1}{2}</b> </td></tr>", mail_text, mrd.Dto.MasterName, ""); //} mail_text = String.Format("{0}<tr><td>from: </td><td><b>{1}</b></td></tr>", mail_text, mrd.Dto.From.ToString()); mail_text = String.Format("{0}<tr><td>until: </td><td><b>{1}</b></td></tr>", mail_text, mrd.Dto.To.HasValue ? mrd.Dto.To.Value.AddDays(-1d).ToString() : mrd.Dto.To.ToString()); mail_text = String.Format("{0}<tr><td>number of records<br>in response file: </td><td><b>{1}</b></td></tr><br>", mail_text, 0); string str = ""; mrd.Dto.MasterQ.ForEach(delegate(MasterQuestionnaireDto mq) { str = string.Format("{4}{0}-{1}({2}={3})<br>", mq.CName, mq.QName, "qid", mq.QId.ToString(), str); }); mail_text = String.Format("{0}<tr><td>list of questionnaires/<br>processors contained<br>in this master report: </td><td><b>{1}</b></td></tr></table><br>", mail_text, str); mail_text = String.Format("{0}<br>Regards,<br>Your RFG-team</p></span>", mail_text); #endregion msg.Body = mail_text; //.NET 1.1: SmtpMail.Send(msg); SmtpClient smtp = new SmtpClient(utility.getParameter("smtp")); smtp.Send(msg); msg.Dispose(); #endregion } }
public void TestSelectAllPermittedUsersForMasterreport() { QuestionnaireDto q1 = SetupQuestionnaireForMasterReport(Q1Elements); QuestionnaireDto q2 = SetupQuestionnaireForMasterReport(Q1Elements); QuestionnaireDto q3 = SetupQuestionnaireForMasterReport(Q1Elements); MasterReport mrp = new MasterReport(TestUser); //create report mrp.CreateMasterReport("master name", TestUser, Migration.Convert(ScheduleMode.Daily), 0, DateTime.Today.AddDays(-1), DateTime.Today.AddDays(1), true, q1.QuestionnaireId); FormRegistry.MasterReportDao.AddQuestionnaireToReport(mrp.Dto.MasterRptId, q1.QuestionnaireId); mrp.Save(); _createdMasterReports.Add(mrp.Dto.MasterRptId); List<MasterReportDto> list = FormRegistry.MasterReportDao.GetMasterReports(true, 0, null, null, "ad"); MasterReportDto mine = list.Find(delegate(MasterReportDto cur) { return cur.MasterRptId == mrp.Dto.MasterRptId; }); string email = "*****@*****.**" + GetNewStamp(); string login = "******" + GetNewStamp(); string password = "******"; bool isAdmin = false; UserType type = UserType.CountryUserWithDataAccess; UserCompanyType companytype = UserCompanyType.HPI; List<CountryDto> listOfPermittedCountriesQuestionnaire = CommonFacade.GetListOfCountries("'uk'"); int Company_Code = 0; UserDto user = new UserDto(email, isAdmin, password, login, type, listOfPermittedCountriesQuestionnaire, null, Company_Code, companytype); List<UserDto> listOfUsers = AdminRegistry.UserDao.SelectAllPermittedUsersPermittedForMasterreport(mine.MasterRptId); Assert.IsTrue(listOfUsers.Find(u => u.Login == login) == null); Assert.IsTrue(AdminRegistry.UserDao.CreateOrUpdate(user, "insert", null, null)); foreach (CountryDto country in listOfPermittedCountriesQuestionnaire) { UserFacade.CreateOrUpdate(user, "country", "q", country.Country); } UserDto sel = AdminRegistry.UserDao.GetByLogin(login); Assert.IsTrue(listOfUsers.Find(u => u.Equals(sel)) != null); Assert.IsTrue(AdminRegistry.UserDao.Delete(user)); }
protected void save_Click(object sender, System.EventArgs e) { #region custom validate bool isValid = true; if (isValid) if ((mFrom.Text == "") || (mUntil.Text == "")) { isValid = false; lbl0.ForeColor = Color.Red; string msg = string.IsNullOrEmpty(mFrom.Text.Trim()) ? "From Date" : ""; msg = string.IsNullOrEmpty(mUntil.Text.Trim()) ? msg + ",Until Date" : msg; lbl0.Text = string.Format("<b>{0} cannot be empty</b>", msg.TrimStart(',')); } if (isValid) isValid = validateDate(mFrom.Text, mUntil.Text); if (isValid) { Int32 Masterrpt_id = 0; mrd = new MasterReport(permss.EmailAddress); if (int.TryParse(MaterRptId.Value, out Masterrpt_id)) mrd.Dto.MasterRptId = Masterrpt_id; mrd.Dto.MasterName = tbreportname.Text; mrd.Dto.From = Convert.ToDateTime(mFrom.Text); DateTime until = Convert.ToDateTime(mUntil.Text); //TODO Susann change to also recognize responses received after (milliseconds) 23:59:59,000 //until = until.AddHours(23).AddMinutes(59).AddSeconds(59); until = until.AddDays(1d); mrd.Dto.To = until; SendNow(mrd); } //#region check if schedule_recipient is correct if used //string schedule_recipient = ""; //string tb_recipient_input = tb_recipient.Text.Trim(); //if (permss.adminrole) //{ // if (tb_recipient_input.Length != 0 && dd_possible_users.SelectedIndex != 0) // { // //which recipient has to be set?? // isValid = isValid & false; // lb_email_error_tworecipients.Visible = true; // } // else // { // if (tb_recipient_input.Length != 0) // { // //validate that recipient(s) is/are HP/EDS-email_address(es) // if (!Check_email_entries(tb_recipient_input)) // //if (!tb_recipient_input.EndsWith("@hp.com")) // { // //show error // isValid = isValid & false; // //lb_email_error_nonhp.Visible = true; // } // else // { // //check if user is already an RFG user, but doesn't have the permission... // ListItem found_user = dd_possible_users.Items.FindByText(tb_recipient_input); // if (found_user != null) // { // //everything is almost fine but exchange the values... // schedule_recipient = tb_recipient_input; // tb_recipient.Text = ""; // dd_possible_users.SelectedItem.Selected = false; // found_user.Selected = true; // } // else // { // //ask database // Hashtable h_params = new Hashtable(); // h_params.Add("useremail", tb_recipient_input); // DataTable existing_user = DB.execProc("select_user", h_params); // if (existing_user.Rows.Count != 0) // { // //user doesn't have the correct permissions for this questionnaire // isValid = isValid & false; // lb_email_error_nopermission.Visible = true; // } // else // { // //user doesn't exist // schedule_recipient = tb_recipient_input; // } // } // } // } // if (dd_possible_users.SelectedIndex != 0) // { // schedule_recipient = dd_possible_users.SelectedItem.Text; // } // } //} //#endregion #endregion if (isValid) { Response.Redirect("index_MasterReport.aspx"); } }
public void scheduledexports_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { System.Web.UI.WebControls.DataList dl_scheduledexports = (DataList)this.FindControl("scheduledexports_list"); string master_id = dl_scheduledexports.DataKeys[e.Item.ItemIndex].ToString(); scheduledexports = (DataTable)Session["scheduledMasterexports"]; DataRow scheduledexport = scheduledexports.Rows.Find(master_id); if ((bool)scheduledexport["enabled"]) { //string questionnaire_name = String.Format("{0}/{1} ({2})", scheduledexport["country_name"].ToString(), scheduledexport["language_name"].ToString(), scheduledexport["qid_title"].ToString()); string schedule_day = scheduledexport["schedule_day"].ToString(); if (schedule_day == "") { schedule_day = "7"; } string command = e.CommandName; switch(command) { case "edit": //Session["schedule_id"] = schedule_id; //Session["campaign_name"] = scheduledexport["campaign_code_FK"].ToString(); //Session["questionnaire_name"] = questionnaire_name; //Session["country_FK"] = scheduledexport["country_FK"].ToString(); //Session["mode"] = scheduledexport["schedule_mode"].ToString(); //Session["day"] = schedule_day; Session["recipient"] = scheduledexport["recipient_email"].ToString(); MasterReport mrd = new MasterReport(permss.EmailAddress); mrd.Dto.MasterRptId = int.Parse(master_id); mrd.Dto.MasterName = scheduledexport["master_name"].ToString(); mrd.Dto.ScheduleMode = Migration.ConvertToScheduleMode(scheduledexport["schedule_mode"].ToString()); mrd.Dto.ScheduleDay = int.Parse(schedule_day); mrd.Dto.RecipientEmail = scheduledexport["recipient_email"].ToString(); mrd.SetHeadings(scheduledexport["master_element_headings"].ToString()); mrd.Dto.MElementType = scheduledexport["master_element_types"].ToString(); Session["MasterSch"] = mrd; Session["scheduled"] = true; this.Response.Redirect("edit_scheduled_MasterReport.aspx?content=edit"); break; case "delete": Session["master_id_name"] = String.Format("{0} ", scheduledexport["master_name"].ToString()); Session["master_id"] = master_id; this.Response.Redirect("delete_scheduled_Masterexport.aspx"); break; default: break; } } else { error_table.Visible = true; } }
public void scheduledexports_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { System.Web.UI.WebControls.DataList dl_scheduledexports = (DataList)this.FindControl("scheduledexports_list"); string master_id = dl_scheduledexports.DataKeys[e.Item.ItemIndex].ToString(); DataRow scheduledexport = scheduledexports.Rows.Find(master_id); //if ((bool)scheduledexport["enabled"]) //{ //string questionnaire_name = String.Format("{0}/{1} ({2})", scheduledexport["country_name"].ToString(), scheduledexport["language_name"].ToString(), scheduledexport["qid_title"].ToString()); MasterReport mrd = new MasterReport(permss.EmailAddress); mrd.Dto.MasterRptId = int.Parse(master_id); _mstrId = int.Parse(master_id); _mstrName = scheduledexport["master_name"].ToString(); mrd.Dto.MasterName = scheduledexport["master_name"].ToString(); mrd.Dto.ScheduleMode = Migration.ConvertToScheduleMode(scheduledexport["schedule_mode"].ToString()); //mrd.Schedule_Day = 7; mrd.Dto.RecipientEmail = scheduledexport["recipient_email"].ToString(); //if (!string.IsNullOrEmpty(scheduledexport["from"].ToString())) // mrd.Dto.From = (DateTime)scheduledexport["from"]; //else mrd.Dto.From = null; //if (!string.IsNullOrEmpty(scheduledexport["to"].ToString())) // mrd.Dto.To = (DateTime)scheduledexport["to"]; //else mrd.Dto.To = null; mrd.SetHeadings(scheduledexport["master_element_headings"].ToString()); mrd.Dto.MElementType = scheduledexport["master_element_types"].ToString(); string command = e.CommandName; switch(command) { case "edit": Server.Transfer("edit_scheduled_MasterReport.aspx?content=edit"); break; case "delete": Server.Transfer("delete_scheduled_Masterexport.aspx"); break; case "send": Server.Transfer("MasterReportNow.aspx"); break; case "schedule": Server.Transfer("MasterReportScheduled.aspx"); break; default: break; } //} //else //{ // error_table.Visible = true; //} }