public override void Save()
        {
            bool saveToDB = SaveRecord();
            bool saveEval = false;

            if (saveToDB)
            {
                //��������
                SupplierEvaluation eval = new SupplierEvaluation(EvaluationType.Lead, selectedSupplier, LeadId, score_s, score_r, score_q, score_v, BuyerEmail, isRecommend);
                saveEval=eval.Save();
            }

            if (saveEval)
            {
                base.Save();

                XmlNode spRootNode = xmlDoc.DocumentElement.SelectSingleNode("Suppliers");
                XmlNode node = xmlDoc.CreateElement("Supplier");
                node.Attributes["id"].Value = selectedSupplier.ToString();
                node.Attributes["scoreQ"].Value = score_q.ToString();
                node.Attributes["scoreS"].Value = score_s.ToString();
                node.Attributes["scoreV"].Value = score_v.ToString();
                node.Attributes["scoreR"].Value = score_r.ToString();

                node.SelectSingleNode("Remark").FirstChild.Value = remark;
                spRootNode.AppendChild(node);

                xmlDoc.Save(xmlDocSavePath + Type + "\\" + Guid + ".xml");
            }
        }
        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");
        }
        public static ArrayList List(EvaluationType eType, int comId, int relatedId, Pager pager)
        {
            /*
             SupplierEvaluationList
            @type smallint=0,
            @comId int=0,
            @rid int=0,
            @pageIndex int=1,
            @pageSize int=20,
            @sort int=0
             */

            //[Id], Type, CompanyId, RelatedId, BuyerEmail,
            //Specialty, Responsibility, Quality, Valuably, CaseScore,
            //[Datetime], Recommend

            ArrayList list = new ArrayList();

            SqlParameter[] prams ={
                Database.MakeInParam("@type",SqlDbType.SmallInt,(short)eType),
                Database.MakeInParam("@comId",SqlDbType.Int,comId),
                Database.MakeInParam("@rid",SqlDbType.Int,relatedId),
                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, "SupplierEvaluationList", prams);

                if (reader.Read())
                {
                    pager.RecordCount = reader.GetInt32(0);

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            SupplierEvaluation eval = new SupplierEvaluation();
                            eval.id = reader.GetInt32(0);
                            eval.type = (EvaluationType)(reader.GetInt16(1));
                            eval.companyId = reader.GetInt32(2);
                            eval.relatedId = reader.GetInt32(3);
                            eval.buyerEmail = reader.GetString(4);
                            eval.specialty = reader.GetInt16(5);
                            eval.responsibility = reader.GetInt16(6);
                            eval.quality = reader.GetInt16(7);
                            eval.valuably = reader.GetInt16(8);
                            eval.caseScore = reader.GetInt16(9);
                            eval.datetime = reader.GetDateTime(10);
                            eval.recommend = reader.GetBoolean(11);
                            list.Add(eval);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {
                //throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
        public bool Save()
        {
            if (SaveRecord())
            {
                //��������
                foreach (string id in suppliers.Keys)
                {
                    FeedBackSupplierItem item=(FeedBackSupplierItem)suppliers[id];
                    if (item.IsContacted || item.IsSelected)
                    {
                        SupplierEvaluation eval = new SupplierEvaluation(EvaluationType.Lead,
                            item.SupplierId,
                            LeadId,
                            item.ScoreS,
                            item.ScoreR,
                            item.ScoreQ,
                            item.ScoreV,
                            BuyerEmail,
                            item.IsRecommend);
                        eval.Save();
                    }
                }

                //�����������ݵ�XML
                xmlDoc.Save(xmlDocSavePath + Type + "\\" + Guid + ".xml");
                return true;
            }

            return false;
        }
 public static SupplierEvaluation Get()
 {
     SupplierEvaluation se = new SupplierEvaluation();
     return se;
 }