protected override void OnInit(EventArgs e) { base.OnInit(e); if (String.IsNullOrEmpty(Request.QueryString.ToString().Trim())) { Response.Clear(); Response.Write("��Ч���ʣ�"); Response.End(); return; } if (Supplier.IsLogined) { Response.Clear(); Response.Redirect("/Suppliers"); return; } string arg = Request.QueryString.ToString().Trim(); NameValueCollection nc = CrypticString.GetQueryString(arg); string guid = nc["guid"] == null ? "" : nc["guid"]; CurrentSupplier = PreSupplier.Get(guid,false); if (CurrentSupplier == null) { Response.Clear(); Response.Write("��Ч���ʣ�"); Response.End(); return; } SupplierID = CurrentSupplier.DoConvert(); if (SupplierID > 0) { Converted = true; IsSupplier = Supplier.IsSupplier(CurrentSupplier.Email, CurrentSupplier.GetDefaultPassword(), Util.GetIP()); } }
private static PreSupplier Get(string id,short converted) { /* PreSupplierGet @id varchar(50), @cov smallint=-1 */ //[Id], Guid, Email, CompanyName,Category, [Name], Gender,Phone, ExpertGuid, [Datetime],Converted, Proved PreSupplier sp = null; SqlDataReader reader = null; try { reader = Database.ExecuteReader(CommandType.StoredProcedure, "PreSupplierGet", new SqlParameter[] { Database.MakeInParam("@id", SqlDbType.VarChar, 50, id), Database.MakeInParam("@cov", SqlDbType.SmallInt,converted) }); if (reader.Read()) { sp = new PreSupplier(); sp.id = reader.GetInt32(0); sp.guid = reader.GetString(1); sp.email = reader.GetString(2); sp.companyName = reader.GetString(3); sp.category = reader.GetString(4); sp.name = reader.GetString(5); sp.gender = Convert.ToChar(reader.GetString(6)); sp.phone = reader.GetString(7); sp.expertGuid = reader.GetString(8); sp.datetime = reader.GetDateTime(9); sp.converted = reader.GetBoolean(10); sp.proved = reader.GetBoolean(11); } reader.Close(); } catch { // } finally { if (reader != null) { reader.Close(); } } return sp; }
private void SendMessage() { if (!Cookies.HasCookie(MESSAGE_COOKIE_NAME)) { Response.Write("false"); return; } string _attachMsg = Request.Form["attachMsg"] == null ? "" : Util.HtmlEncode(Request.Form["attachMsg"].Trim()); string _guid = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "GUID"); string _comName = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "COMNAME"); string _name = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "NAME"); string _gender = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "GENDER") == "M" ? " ����" : " Ůʿ"; string _category = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "CATEGORY"); string _categoryName = Dictionary.GetDictionaryName(DictionaryType.C, _category); string _email = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "EMAIL"); string _phone = Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "PHONE"); PreSupplier sp = new PreSupplier(ExpertGuid, _guid); sp.Category = _category; sp.CompanyName = _comName; sp.Name = _name; sp.Gender=Cookies.GetCookieValue(MESSAGE_COOKIE_NAME, "GENDER") == "M"?'M':'F'; sp.Email = _email; sp.Phone = _phone; int spId=sp.Save(); if (spId > 0) { MailTempItem mailTemp = MailTemplates.GetTemplate("expert_invisit_mail"); string[] args = new string[] { _name+_gender, _comName, _category, _categoryName, ExpertName, ExpertEmail, CrypticString.Encrypt("guid="+sp.Guid,true) }; SmtpMail sm = SmtpMail.Instance; sm.AddRecipient(new string[] { _email }); sm.Html = mailTemp.Html; sm.Subject = String.Format(mailTemp.Subject, args); sm.Body = String.Format(mailTemp.Body, args); if (!String.IsNullOrEmpty(_attachMsg)) { sm.Body += sm.Html ? "<p>������ " + ExpertName + " ���������ԣ�</p><p>" + _attachMsg + "</p>" : "������" + ExpertName + "���������ԣ�\r\n" + _attachMsg; } if (sm.Send()) { Response.Write("true"); Cookies.RemoveCookie(MESSAGE_COOKIE_NAME); return; } } Response.Write("false"); }
public static ArrayList List(string expGuid, Pager pager) { /* PreSupplierList @expGuid varchar(32)='', @pageIndex int=1, --ָ����ҳҳ�� @pageSize int=20, --ָ����ҳ��С @sort int=0 --ָ������ */ //[Id], Guid, Email, CompanyName,Category, [Name], Gender,Phone, ExpertGuid, [Datetime],Converted, Proved,ExpertName ArrayList list = new ArrayList(); SqlDataReader reader = null; try { reader = Database.ExecuteReader(CommandType.StoredProcedure, "PreSupplierList", new SqlParameter[] { Database.MakeInParam("@expGuid",SqlDbType.VarChar,32,expGuid), Database.MakeInParam("@pageIndex",SqlDbType.Int,pager.PageIndex), Database.MakeInParam("@pageSize",SqlDbType.Int,pager.PageSize), Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum) }); if (reader.Read()) { pager.RecordCount = reader.GetInt32(0); if (reader.NextResult()) { while (reader.Read()) { PreSupplier sp = new PreSupplier(); sp.id = reader.GetInt32(0); sp.guid = reader.GetString(1); sp.email = reader.GetString(2); sp.companyName = reader.GetString(3); sp.category = reader.GetString(4); sp.name = reader.GetString(5); sp.gender = Convert.ToChar(reader.GetString(6)); sp.phone = reader.GetString(7); sp.expertGuid = reader.GetString(8); sp.datetime = reader.GetDateTime(9); sp.converted = reader.GetBoolean(10); sp.proved = reader.GetBoolean(11); sp.expertName = reader.IsDBNull(12) ? "" : reader.GetString(12); list.Add(sp); } } } reader.Close(); } catch { throw; } finally { if (reader != null) { reader.Close(); } } return list; }