Esempio n. 1
0
        private void CheckCertStatus()
        {
            if(Request.Form["id"]!=null &&
                Request.Form["status"] != null)
            {
                bool sta = Request.Form["status"] == "1";
                int id = Convert.ToInt32(Request.Form["id"]);
                CompanyCertificate.SetCheck(id, sta);

                if (sta)//���ͨ��������ϵͳ��Ϣ
                {
                    CompanyCertificate cert = CompanyCertificate.Get(id);
                    if (cert != null)
                    {
                        MailTempItem msgTemp = MailTemplates.GetTemplate("msg_sp_cert_checkpass");
                        Message msg = new Message(MessageType.CertValidMessage);
                        msg.CompanyId = cert.CompanyId;
                        msg.Title = String.Format(msgTemp.Subject,cert.Title);
                        msg.Body = String.Format(msgTemp.Body,cert.Title);
                        msg.Priority = MessagePriority.High;
                        msg.Save();
                    }
                }

                Response.Write("true");
                return;
            }

            Response.Write("false");
        }
Esempio n. 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!Cookies.HasCookie("SP_REG_TEMP"))
            {
                Response.Redirect("join.aspx");
                Response.End();
            }

            MailSended = false;
            ComGuid = Cookies.GetCookieValue("SP_REG_TEMP", "guid");
            ComEmail = Cookies.GetCookieValue("SP_REG_TEMP", "email");
            ComName = Cookies.GetCookieValue("SP_REG_TEMP", "comname");

            //���ͻ�ӭ��Ϣ
            MailTempItem msgTemp = MailTemplates.GetTemplate("msg_sp_welcome");
            Message msg = new Message(MessageType.SystemNotice);
            msg.CompanyId = Convert.ToInt32(Cookies.GetCookieValue("SP_REG_TEMP", "id"));
            msg.Title = msgTemp.Subject;
            msg.Body = msgTemp.Body;
            msg.Priority = MessagePriority.Normal;
            msg.Save();

            //���ͼ����ʼ�
            MailTempItem mailTemp = MailTemplates.GetTemplate("sp_join");
            if (mailTemp != null)
            {
                string activeCode = GuidQueue.Create(GuidQueueType.SupplierActiveAccount, ComEmail);

                string[] args = new string[] {
                    ComEmail,
                    Cookies.GetCookieValue("SP_REG_TEMP", "pwd"),
                    Cookies.GetCookieValue("SP_REG_TEMP", "name"),
                    ComName,
                    CrypticString.Encrypt("email="+ComEmail+"&guid="+activeCode,true)
                };

                SmtpMail sm = SmtpMail.Instance;
                sm.AddRecipient(new string[] { ComEmail });
                sm.Html = mailTemp.Html;
                sm.Subject = String.Format(mailTemp.Subject, args);
                sm.Body = String.Format(mailTemp.Body, args);

                MailSended = sm.Send();
                if (!MailSended)
                {
                    Log.AddLog(LogType.SystemLog, ComEmail, "����ע���ʼ�ʧ�ܣ�" + sm.ErrorMessage + "");
                }
            }

            if (MailSended)
            {
                Cookies.RemoveCookie("SP_REG_TEMP");
            }
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Converted)//send mail
            {
                //���ͻ�ӭ��Ϣ
                MailTempItem msgTemp = MailTemplates.GetTemplate("msg_sp_welcome");
                Message msg = new Message(MessageType.SystemNotice);
                msg.CompanyId = SupplierID;
                msg.Title = msgTemp.Subject;
                msg.Body = msgTemp.Body;
                msg.Priority = MessagePriority.Normal;
                msg.Save();

                //��ӭ�ʼ�
                MailTempItem mailTemp = MailTemplates.GetTemplate("sp_welcome");
                string[] args = new string[] {
                    CurrentSupplier.Email,
                    CurrentSupplier.GetDefaultPassword()
                };

                SmtpMail sm = SmtpMail.Instance;
                sm.AddRecipient(new string[] { CurrentSupplier.Email });
                sm.Html = mailTemp.Html;
                sm.Subject = String.Format(mailTemp.Subject, args);
                sm.Body = String.Format(mailTemp.Body, args);

                MailSended = sm.Send();
                if (!MailSended)
                {
                    Log.AddLog(LogType.SystemLog, CurrentSupplier.Email, "������ʱ��Ӧ�̻�ӭ�ʼ�ʧ�ܣ�" + sm.ErrorMessage + "");
                }
            }
        }
Esempio n. 4
0
        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");
        }
Esempio n. 5
0
        private static ArrayList List(int comId, short type, short isread, Pager pager)
        {
            /*
             CompanyInBoxList
            @comId int=0,
            @type smallint=0,
            @isread smallint=-1,
            @pageIndex int=1,
            @pageSize int=20,
            @sort int=0
             */

            //[Id], CompanyId, Type, Priority, Title, [Datetime], Readed, ReadDatetime,[From]

            ArrayList list = new ArrayList();

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

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

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            Message msg = new Message();
                            msg.id = reader.GetInt32(0);
                            msg.companyId = reader.GetInt32(1);
                            msg.type = (MessageType)reader.GetInt16(2);
                            msg.priority = (MessagePriority)reader.GetInt16(3);
                            msg.title = reader.GetString(4);
                            msg.datetime = reader.GetDateTime(5);
                            msg.readed = reader.GetString(6) == "1";
                            msg.readedTime = reader.IsDBNull(7)?DateTime.Now:reader.GetDateTime(7);
                            msg.from = reader.GetString(8);
                            list.Add(msg);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {
                //throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Esempio n. 6
0
        public static Message Get(int id,int comId)
        {
            /*
             CompanyInBoxGet
            @id int,
            @comId int=0
             */

            //[Id], CompanyId, Type, Priority, Title, Body, [Datetime], Readed, ReadDatetime,[From]

            Message msg = null;

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "CompanyInBoxGet",
                    new SqlParameter[] { Database.MakeInParam("@id", SqlDbType.Int, id),
                                        Database.MakeInParam("@comId", SqlDbType.Int, comId) });
                if (reader.Read())
                {
                    msg = new Message();
                    msg.id = reader.GetInt32(0);
                    msg.companyId = reader.GetInt32(1);
                    msg.type = (MessageType)reader.GetInt16(2);
                    msg.priority = (MessagePriority)reader.GetInt16(3);
                    msg.title = reader.GetString(4);
                    msg.body = reader.GetString(5);
                    msg.datetime = reader.GetDateTime(6);
                    msg.readed = reader.GetString(7) == "1";
                    msg.readedTime = reader.IsDBNull(8) ? DateTime.Now : reader.GetDateTime(8);
                    msg.from = reader.GetString(9);
                }
                reader.Close();
            }
            catch
            {
                //
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return msg;
        }