protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (IsPost) { } else { try { int caseId = Convert.ToInt32(Request.QueryString["id"]); CurrentCase = CompanyCase.Get(caseId); } catch { // } if (CurrentCase == null) { Response.Clear(); Response.Write("��ȡ���ݴ���!"); Response.End(); } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (IsPost) { Response.Clear(); switch (AjaxAction) { case "CaseEvalPage.evaluation": DoEvaluation(); break; } Response.End(); } else { string query = Request.QueryString.ToString().Trim(); if (!String.IsNullOrEmpty(query)) { EvaluateData = query; NameValueCollection nc = CrypticString.GetQueryString(query); string email = nc["email"] == null ? "" : nc["email"]; int comid = nc["comid"] == null ? 0 : Convert.ToInt32(nc["comid"]); int caseId = nc["caseid"] == null ? 0 : Convert.ToInt32(nc["caseid"]); //Response.Write(email+","+comid.ToString()+","+caseId.ToString()); if (comid > 0 && caseId > 0) { CurrentCase = CompanyCase.Get(caseId, comid); if(CurrentCase!=null) { if (CurrentCase.Status != CaseStatus.Evaluating) { CurrentCase = null; return; } Evaluated = (CurrentCase.Status ==CaseStatus.Evalueated); } } } } }
private void DoEvaluation() { if (Request.Form["evalue"] == null || Request.Form["evalData"] == null) { Response.Write("false"); return; } short eval = Convert.ToInt16(Request.Form["evalue"]); string data = Request.Form["evalData"].Trim(); NameValueCollection nc = CrypticString.GetQueryString(data); string email = nc["email"] == null ? "" : nc["email"]; int comid = nc["comid"] == null ? 0 : Convert.ToInt32(nc["comid"]); int caseId = nc["caseid"] == null ? 0 : Convert.ToInt32(nc["caseid"]); CurrentCase = CompanyCase.Get(caseId, comid); { if (CurrentCase != null) { SupplierEvaluation spEval = new SupplierEvaluation(EvaluationType.Case, comid, caseId, eval, email, false); bool bln = spEval.Save(); //����ϵͳ��Ϣ MailTempItem msgTemp = MailTemplates.GetTemplate("msg_sp_case_evaluated"); Message msg = new Message(MessageType.SystemNotice); msg.CompanyId = comid; msg.Priority = MessagePriority.Normal; msg.Title = String.Format(msgTemp.Subject, email, CurrentCase.Title); msg.Body = String.Format(msgTemp.Body, email, CurrentCase.Title); msg.Save(); } } Response.Write("true"); }
private string GetCasesList(string format, CompanyCase[] cases) { StringBuilder html = new StringBuilder(); foreach (CompanyCase ca in cases) { html.AppendFormat(format, ca.Id, ca.Title, ca.ClientName, ca.ClientWebsite, ca.Background, ca.Description, ca.Result, ca.Period, ca.Status == CaseStatus.Evalueated ? "evalueated" : ""); } return html.ToString(); }
private void SaveCase() { if (Request.Form["caseTitle"] != null && Request.Form["caseCate"] != null && Request.Form["cName"] != null && Request.Form["cIndustry"] != null && Request.Form["cUrl"] != null && Request.Form["casePeriod"] != null && Request.Form["caseBground"] != null && Request.Form["caseDesc"] != null && Request.Form["caseResult"] != null && Request.Form["caseId"] != null) { int cid = Convert.ToInt32(Request.Form["caseId"]); CompanyCase ca = new CompanyCase(SupplierId); ca.Title = Request.Form["caseTitle"].Trim(); ca.Category = Request.Form["caseCate"].Trim(); ca.ClientName = Request.Form["cName"].Trim(); ca.ClientIndustry = Request.Form["cIndustry"].Trim(); ca.ClientWebsite = Request.Form["cUrl"].Trim(); ca.Period = Request.Form["casePeriod"].Trim(); ca.Background = Request.Form["caseBground"].Trim(); ca.Description = Request.Form["caseDesc"].Trim(); ca.Result = Request.Form["caseResult"].Trim(); if (ca.Save(cid)) { //ͬ������Minisite�İ��� MinisiteWriter mw = new MinisiteWriter(SupplierId); mw.UpdateCases(true); Response.Write(ca.Id); return; } Response.Write(0); return; } else { Response.Write(0); } }
public CompanyCase GetCase(string id) { XmlNode node = configDoc.SelectSingleNode("//Cases/Case[@id='" + id + "']"); if (node == null) { return null; } CompanyCase c = new CompanyCase(supplierId, Convert.ToInt32(node.Attributes["id"].Value), Convert.ToInt16(node.Attributes["status"].Value)); c.Period = node.Attributes["period"].Value; c.Title = node.SelectSingleNode("Title").FirstChild.Value; c.ClientName = node.SelectSingleNode("ClientName").FirstChild.Value; c.ClientWebsite = node.SelectSingleNode("ClientWebsite").FirstChild.Value; c.Background = node.SelectSingleNode("Background").FirstChild.Value; c.Description = node.SelectSingleNode("Description").FirstChild.Value; c.Result = node.SelectSingleNode("Result").FirstChild.Value; return c; }
private XmlNode CreateNewCaseNode(CompanyCase c) { XmlNode node = configDoc.CreateElement("Case"); XmlAttribute attr = configDoc.CreateAttribute("id"); attr.Value = c.Id.ToString(); node.Attributes.Append(attr); attr = configDoc.CreateAttribute("period"); attr.Value = c.Period; node.Attributes.Append(attr); attr = configDoc.CreateAttribute("status"); attr.Value = ((short)c.Status).ToString(); node.Attributes.Append(attr); XmlNode subNode = configDoc.CreateElement("Title"); XmlCDataSection cdata = configDoc.CreateCDataSection(Util.HtmlEncode(c.Title)); subNode.AppendChild(cdata); node.AppendChild(subNode); subNode = configDoc.CreateElement("ClientName"); cdata = configDoc.CreateCDataSection(Util.HtmlEncode(c.ClientName)); subNode.AppendChild(cdata); node.AppendChild(subNode); subNode = configDoc.CreateElement("ClientWebsite"); cdata = configDoc.CreateCDataSection(c.ClientWebsite); subNode.AppendChild(cdata); node.AppendChild(subNode); subNode = configDoc.CreateElement("Background"); cdata = configDoc.CreateCDataSection(Util.HtmlEncode(c.Background)); subNode.AppendChild(cdata); node.AppendChild(subNode); subNode = configDoc.CreateElement("Description"); cdata = configDoc.CreateCDataSection(Util.HtmlEncode(c.Description)); subNode.AppendChild(cdata); node.AppendChild(subNode); subNode = configDoc.CreateElement("Result"); cdata = configDoc.CreateCDataSection(Util.HtmlEncode(c.Result)); subNode.AppendChild(cdata); node.AppendChild(subNode); return node; }
public static ArrayList List(int comId,bool chkExpire, Pager pager) { /* CompanyCaseList @comId int=0, @expired int=0, @pageIndex int=1, @pageSize int=20, @sort int=0 */ //[Id],CompanyId, Category, Title, ClientName, ClientIndustry,ClientWebsite, //Period,[Datetime], Status ArrayList list = new ArrayList(); SqlParameter[] prams ={ Database.MakeInParam("@comId",SqlDbType.Int,comId), Database.MakeInParam("@expired",SqlDbType.SmallInt,chkExpire?GeneralConfig.Instance.SupplierCaseEvaluationExpired:(short)0), Database.MakeInParam("@pageIndex",SqlDbType.Int,pager.PageIndex), Database.MakeInParam("@pageSize",SqlDbType.Int,pager.PageSize), Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum) }; SqlDataReader reader = null; try { reader = Database.ExecuteReader(CommandType.StoredProcedure, "CompanyCaseList", prams); if (reader.Read()) { pager.RecordCount = reader.GetInt32(0); if (reader.NextResult()) { while (reader.Read()) { CompanyCase c = new CompanyCase(); c.id = reader.GetInt32(0); c.companyId = reader.GetInt32(1); c.category = reader.GetString(2); c.title = reader.GetString(3); c.clientName = reader.GetString(4); c.clientIndustry = reader.GetString(5); c.clientWebsite = reader.GetString(6); c.period = reader.GetString(7); c.datetime = reader.GetDateTime(8); c.status = (CaseStatus)reader.GetInt16(9); list.Add(c); } } } reader.Close(); } catch { //throw; } finally { if (reader != null) { reader.Close(); } } return list; }
public static CompanyCase Get(int id,int comId) { /* CompanyCaseGet @id int, @comId int=0 */ //[Id],CompanyId, Category, Title, ClientName, ClientIndustry, ClientWebsite, //Period, Background, [Description], Result, [Datetime], Status CompanyCase c = null; SqlDataReader reader = null; try { reader = Database.ExecuteReader(CommandType.StoredProcedure, "CompanyCaseGet", new SqlParameter[] { Database.MakeInParam("@id", SqlDbType.Int, id), Database.MakeInParam("@comId", SqlDbType.Int, comId) }); if (reader.Read()) { c = new CompanyCase(); c.id = reader.GetInt32(0); c.companyId = reader.GetInt32(1); c.category = reader.GetString(2); c.title = reader.GetString(3); c.clientName = reader.GetString(4); c.clientIndustry = reader.GetString(5); c.clientWebsite = reader.GetString(6); c.period = reader.GetString(7); c.background = reader.GetString(8); c.description = reader.GetString(9); c.result = reader.GetString(10); c.datetime = reader.GetDateTime(11); c.status = (CaseStatus)reader.GetInt16(12); } reader.Close(); } catch { // } finally { if (reader != null) { reader.Close(); } } return c; }
protected CaseViewPage() : base() { CurrentCase = null; }