protected void Page_Load(object sender, EventArgs e) { if (!Login()) { Response.Redirect("/login.aspx"); } else { ProjectReport pr = new ProjectReport(); pr.UC = UC; pr.prjID = long.Parse(Request["prjId"]); prjStatus.Text = pr.FillStatus(); } }
private void MakeTiming() { ProjectReport pr = new ProjectReport(); pr.UC = UC; pr.prjID = long.Parse(Session["selectprj"].ToString()); bool allmember = true; if (TimeOwnerRealID.Text.Length > 0) { pr.MemberId = long.Parse(TimeOwnerRealID.Text); allmember = false; } string print = string.Format("<p align=right><img src=/i/printer.gif onclick=\"PrintTiming({0},{1})\"></p>", Session["selectprj"].ToString(), 9); lblTiming.Text = print + pr.ProjectTiming(true, allmember); }
protected void Page_Load(object sender, EventArgs e) { if (!Login()) { Response.Redirect("/login.aspx"); } else { if (Session["currentproject"] != null) { Gantt1.prjID = long.Parse(Session["currentproject"].ToString()); Session.Remove("currentproject"); } Gantt1.MakeGantt(); litPrint.Text = string.Format("<img src=/i/printer.gif border=0 style=\"cursor:pointer\" onclick=\"PrintGantt({0})\">", Gantt1.prjID); ProjectReport pr = new ProjectReport(); pr.prjID = Gantt1.prjID; pr.UC = UC; litForecast.Text = pr.ForecastDate(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Login()) { ClientScript.RegisterStartupScript(this.GetType(), "endsession", "<script>opener.location.href=opener.location.href;self.close();</script>"); } else { switch (Request["Report"]) { case "1": // Gantt Gantt1.prjID = long.Parse(Request["Prj"].ToString()); Gantt1.MakeGantt(); break; case "0": // GanttPDF Gantt1.NoRender = true; Gantt1.prjID = long.Parse(Request["Prj"].ToString()); Gantt1.MakeGantt(); Gantt1.Visible = false; GetGanttPDF(Gantt1.Img1, Gantt1.Img2); break; case "2": // Timing per utente ProjectReport pr = new ProjectReport(); pr.UC = UC; pr.prjID = long.Parse(Request["Prj"].ToString()); if (Request["Member"] != null) { pr.MemberId = long.Parse(Request["Member"].ToString()); lblPrint.Text = pr.ProjectTiming(false, false); } else { lblPrint.Text = pr.ProjectTiming(false, true); } break; } } }
void btnSendMails_Click(object sender, EventArgs e) { string mailTo = string.Empty; string mailSubject = string.Empty; string mailBody = string.Empty; string query = string.Empty; DataSet ds = new DataSet(); switch (selectMailSend.SelectedValue) { case "0": string[] adminId = DatabaseConnection.SqlScalar("SELECT ADMINACCOUNT+CAST(OWNER AS VARCHAR(10)) FROM PROJECT WHERE ID=" + prjID).Split('|'); foreach (string adm in adminId) { if (adm.Length > 0) { mailTo += DatabaseConnection.SqlScalar("SELECT CASE ISNULL(NOTIFYEMAIL,'') WHEN '' THEN USERACCOUNT ELSE NOTIFYEMAIL END AS MAIL FROM ACCOUNT WHERE UID=" + adm) + ";"; } } query = string.Format(@"SELECT CASE ISNULL(ACCOUNT.NOTIFYEMAIL,'') WHEN '' THEN ACCOUNT.USERACCOUNT ELSE ACCOUNT.NOTIFYEMAIL END AS MAIL, PROJECT_MEMBERS.ID FROM PROJECT_MEMBERS INNER JOIN PROJECT_TEAMS ON PROJECT_MEMBERS.TEAM=PROJECT_TEAMS.ID INNER JOIN ACCOUNT ON ACCOUNT.UID=PROJECT_MEMBERS.USERID WHERE PROJECT_TEAMS.PROJECTID={0} AND (PROJECT_MEMBERS.TYPE=0 OR PROJECT_MEMBERS.TYPE=2) UNION SELECT BASE_CONTACTS.EMAIL AS MAIL ,PROJECT_MEMBERS.ID FROM PROJECT_MEMBERS INNER JOIN PROJECT_TEAMS ON PROJECT_MEMBERS.TEAM=PROJECT_TEAMS.ID INNER JOIN BASE_CONTACTS ON BASE_CONTACTS.ID=PROJECT_MEMBERS.USERID WHERE PROJECT_TEAMS.PROJECTID={0} AND (PROJECT_MEMBERS.TYPE=1)", this.prjID.Text); ds = DatabaseConnection.CreateDataset(query); foreach (DataRow dr in ds.Tables[0].Rows) { mailTo += dr[0].ToString() + ";"; } break; case "1": adminId = DatabaseConnection.SqlScalar("SELECT ADMINACCOUNT+CAST(OWNER AS VARCHAR(10)) FROM PROJECT WHERE ID=" + prjID.Text).Split('|'); foreach (string adm in adminId) { if (adm.Length > 0) { mailTo += DatabaseConnection.SqlScalar("SELECT CASE ISNULL(NOTIFYEMAIL,'') WHEN '' THEN USERACCOUNT ELSE NOTIFYEMAIL END AS MAIL FROM ACCOUNT WHERE UID=" + adm) + ";"; } } break; case "2": if (MailOwnerType.Text == "0" || MailOwnerType.Text == "2") { query = string.Format(@"SELECT CASE ISNULL(ACCOUNT.NOTIFYEMAIL,'') WHEN '' THEN ACCOUNT.USERACCOUNT ELSE ACCOUNT.NOTIFYEMAIL END AS MAIL, PROJECT_MEMBERS.ID FROM PROJECT_MEMBERS INNER JOIN PROJECT_TEAMS ON PROJECT_MEMBERS.TEAM=PROJECT_TEAMS.ID INNER JOIN ACCOUNT ON ACCOUNT.UID=PROJECT_MEMBERS.USERID WHERE PROJECT_TEAMS.PROJECTID={0} AND PROJECT_MEMBERS.ID={1}", this.prjID.Text, MailOwnerRealID.Text); } else { query = string.Format(@"SELECT BASE_CONTACTS.EMAIL AS MAIL ,PROJECT_MEMBERS.ID FROM PROJECT_MEMBERS INNER JOIN PROJECT_TEAMS ON PROJECT_MEMBERS.TEAM=PROJECT_TEAMS.ID INNER JOIN BASE_CONTACTS ON BASE_CONTACTS.ID=PROJECT_MEMBERS.USERID WHERE PROJECT_TEAMS.PROJECTID={0} AND PROJECT_MEMBERS.ID={1}", this.prjID.Text, MailOwnerRealID.Text); } ds = DatabaseConnection.CreateDataset(query); mailTo = ds.Tables[0].Rows[0][0].ToString(); break; } ProjectReport pr = new ProjectReport(); pr.UC = UC; switch (selectMailType.SelectedValue) { case "0": pr.prjID = long.Parse(this.prjID.Text); mailBody = pr.FillStatus(); MessagesHandler.SendMail(mailTo, "*****@*****.**", mailSubject, mailBody); break; case "1": if (ds.Tables[0].Rows.Count > 0) { pr.prjID = long.Parse(this.prjID.Text); foreach (DataRow dr in ds.Tables[0].Rows) { pr.MemberId = long.Parse(dr[1].ToString()); mailBody = pr.ToDoList(); MessagesHandler.SendMail(dr[0].ToString(), "*****@*****.**", mailSubject, mailBody); } } break; } }