public void SendMail(string name, string loginId, string password, DateTime expireDate, bool isTest) { var cmail = new CMail(); cmail.IsTest = isTest; string tempEmail = “[email protected]”; string from = tempEmail; string to = tempEmail; string subject = string.Empty; string body = string.Empty; string mailTemplate = "AddWPUserSuccessful"; subject = string.Format("【重要】Wordpress投稿アカウント発行のお知らせ:{0}様", name); using (var reader = new StreamReader(HttpContext.Current.Server.MapPath("~/MailTemplate/" + mailTemplate + ".txt"), System.Text.Encoding.Default)) { body = reader.ReadToEnd(); } body = body.Replace("#社員名#", name) .Replace("#ログインID#", loginId) .Replace("#パスワード#", password) .Replace("#有効期限#", expireDate.ToString("yyyy/MM/dd HH:mm:ss")); string[] smtpSettings = ConfigurationManager.AppSettings["Smtp"].Split('/'); if (!cmail.SendMail(smtpSettings[0], Int32.Parse(smtpSettings[1]), from, to, subject, body, "")) { //logger.Error(string.Format("■SendMail Error! : {0}", cmail.ErrMsg)); } }
public object ForgotPassword(string email_id) { try { int isMailsend = 0; var res = dataContext.tbl_All_User.Where(a => a.v_EmailId == email_id).FirstOrDefault(); if (res != null) { isMailsend = sentForgetPasswordEmail(res.v_EmailId, res.v_Password); return(new ResponseModel { StatusCode = isMailsend != 1 ? (int)CCommon.StatusCode.Fail : (int)CCommon.StatusCode.Success, StatusMessaage = isMailsend != 1 ? "Could not find email id in our system." : "Please check your email. The password has been sent there.", data = "" }); } else { return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = "Could not find email id in our system.", data = "" }); } } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "" }); } }
public object ChangePassword(int UserId, string ChangePassword, int int_moduleType_id, string OldPassword) { try { var _userPswd = dataContext.tbl_All_User.Where(a => a.int_id == UserId && a.int_User_Type == int_moduleType_id).FirstOrDefault(); if (_userPswd != null) { if (_userPswd.v_Password != OldPassword) { return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Incorrect Old Password." }); } else { _userPswd.v_Password = ChangePassword; } } int Result = dataContext.SaveChanges(); return(new ResponseModel { StatusCode = Result != 0 ? (int)CCommon.StatusCode.Success : (int)CCommon.StatusCode.Notsaved, StatusMessaage = Result != 0 ? CCommon.StatusCode.Success.ToString() : CCommon.StatusCode.Notsaved.ToString(), data = "" }); } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "" }); } }
private int sentForgetPasswordEmail(string email_id, string password) { return(CMail.SendSystemGeneratedMail(email_id, "Password Retrieved", "Dear User, Your login details are. Your Username is : " + email_id + " and Password is : " + password + "<br/><br/>Thank you,<br/>Just Cool", ConfigurationManager.AppSettings["display_name"], true)); }
public bool SentLink(STUser stUser) { string msg = null; try { CUser clUser = new CUser(stUser.userid, LocalData.CSDbUsers(), LocalData.LogPath()); string key = GenerateKey(); int ret = clUser.SetKeyFPS(stUser.userid, key, out msg); if (ret != 0) { return(false); } CMail clMail = new CMail(stUser.userid, LocalData.CSDbUsers(), LocalData.LogPath()); STMail maildata = new STMail(); maildata.to = stUser.email; maildata.linkkey = key; maildata.tamplate = "MailToUserChangePassword.txt"; maildata.fleetpwd = null; maildata.pan = null; maildata.dtcreate = DateTime.Now.ToString("yyyyMMddHHmmss"); maildata.dtmistsent = null; clMail.Insert(maildata, out msg); SMTPNotice smtp = new SMTPNotice(LocalData.SmtpHost(), LocalData.SmtpPort(), LocalData.SmtpUseSSL(), LocalData.SmtpUserName(), LocalData.SmtpPassword(), LocalData.SmtpFrom(), LocalData.CSDbUsers(), LocalData.LogPath(), LocalData.GetTemplatePath(), LocalData.Images()); smtp.SendNotice(out msg); } catch (Exception ex) { msg = ex.Message; return(false); } return(true); }
private void Draw(CMail mail) { if (this.m_CUIForm != null) { this.m_CUIForm.transform.FindChild("PanelAccess").gameObject.CustomSetActive(true); Text component = this.m_CUIForm.transform.FindChild("PanelAccess/MailContent").GetComponent <Text>(); Text component2 = this.m_CUIForm.transform.FindChild("PanelAccess/MailTitle").GetComponent <Text>(); component.set_text(mail.mailContent); component2.set_text(mail.subject); this.m_CUIListScript.SetElementAmount(mail.accessUseable.Count); for (int i = 0; i < mail.accessUseable.Count; i++) { GameObject gameObject = this.m_CUIListScript.GetElemenet(i).transform.FindChild("itemCell").gameObject; CUICommonSystem.SetItemCell(this.m_CUIForm, gameObject, mail.accessUseable[i], true, true, false, false); } GameObject gameObject2 = this.m_CUIForm.transform.FindChild("PanelAccess/GetAccess").gameObject; gameObject2.CustomSetActive(mail.accessUseable.Count > 0); GameObject gameObject3 = this.m_CUIForm.transform.FindChild("PanelAccess/CheckAccess").gameObject; if (CHyperLink.Bind(gameObject3, mail.mailHyperlink)) { gameObject3.CustomSetActive(true); gameObject2.CustomSetActive(false); } else { gameObject3.CustomSetActive(false); } } }
public object PostLogout(Postloginreq _login) { try { using (newconecommerce dataContext = new newconecommerce()) { dataContext.Database.Connection.Open(); tbl_OTP _logoutInput = dataContext.tbl_OTP.Single(e => e.int_user_id == _login.intloginId && e.dt_logout_time == null); _logoutInput.dt_logout_time = DateTime.Now; dataContext.SaveChanges(); dataContext.Database.Connection.Close(); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "" }); } } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "" }); } }
public UserModel CheckLogin(LoginViewModel _login) { try { UserModel _log = new UserModel(); using (newconecommerce dataContext = new newconecommerce()) { dataContext.Database.Connection.Open(); var command = dataContext.Database.Connection.CreateCommand(); command.CommandText = "[usp_user_login]"; command.CommandType = CommandType.StoredProcedure; var p = new SqlParameter("@v_EmailId", _login.strEmailId); var p1 = new SqlParameter("@v_Password", _login.strPassword); //var p2 = new SqlParameter("@v_MobileNo", _login.strMobileNo); //var p3 = new SqlParameter("@intModuleTypeId", _login.intModuleTypeId); //var p4 = new SqlParameter("@strDeviceId", _login.strDeviceId); //var p5 = new SqlParameter("@strDevicetoken", _login.strDevicetoken); //var p6 = new SqlParameter("@strDevicemode", _login.strDevicemode); command.Parameters.Add(p); command.Parameters.Add(p1); //command.Parameters.Add(p2); //command.Parameters.Add(p3); //command.Parameters.Add(p4); //command.Parameters.Add(p5); //command.Parameters.Add(p6); var reader = command.ExecuteReader(); DataSet oDS = new DataSet(); while (!reader.IsClosed) { oDS.Tables.Add().Load(reader); } if (oDS.Tables[0].Rows.Count != 0) { _log.intUserId = Convert.ToInt32(oDS.Tables[0].Rows[0]["int_id"]); _log.strName = oDS.Tables[0].Rows[0]["strName"].ToString(); _log.strEmailId = oDS.Tables[0].Rows[0]["strEmailId"].ToString(); _log.strMobileNo = oDS.Tables[0].Rows[0]["strMobileNo"].ToString(); dataContext.Database.Connection.Close(); } else { _log.StatusMessaage = oDS.Tables[0].Rows[0]["Msg"].ToString(); } } return(_log); //return new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = _log }; } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); throw ex; } }
private void SetEventParams(CUIEventScript com, CMail mail) { com.m_onClickEventParams.heroId = (uint)mail.bMapType; com.m_onClickEventParams.weakGuideId = mail.dwMapId; com.m_onClickEventParams.tag2 = (int)mail.relationType; com.m_onClickEventParams.tagUInt = mail.dwGameSvrEntity; com.m_onClickEventParams.commonUInt64Param1 = mail.uid; com.m_onClickEventParams.taskId = mail.dwLogicWorldID; com.m_onClickEventParams.tag3 = (int)mail.inviteType; }
public object PostLogin(Postloginreq _login) { try { Random generator = new Random(); string number = generator.Next(1, 10000).ToString("D4"); string strMessage = "Your OTP for Just Cool App is :" + number + ". Regards Corvi.com"; using (newconecommerce dataContext = new newconecommerce()) { var query = (from x in dataContext.tbl_OTP where x.int_user_id == _login.intloginId && x.dt_logout_time == null select x.int_user_id).FirstOrDefault(); if (query != null) { return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Already logged in with other device." }); } else { dataContext.Database.Connection.Open(); tbl_OTP _objLoginInput = new tbl_OTP(); _objLoginInput.int_moduleType_id = _login.intModuleTypeId; _objLoginInput.int_user_id = _login.intloginId; _objLoginInput.int_OTP = Convert.ToInt32(number); _objLoginInput.dt_OTP_created = DateTime.Now; _objLoginInput.dt_login_time = DateTime.Now; _objLoginInput.v_device_id = _login.strDeviceId; _objLoginInput.v_device_token = _login.strDevicetoken; _objLoginInput.v_device_token = _login.strDevicemode; _objLoginInput.dt_created_on = DateTime.Now; dataContext.tbl_OTP.Add(_objLoginInput); dataContext.SaveChanges(); dataContext.Database.Connection.Close(); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "Login success" }); } } } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "Failed to login." }); } }
public object getProductCartByUserId(AddToCartModel addtocart) { try { using (newconecommerce dataContext = new newconecommerce()) { if (addtocart.int_user_id == 0) { return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Incorrect Retailer Id." }); } else { var result = dataContext.usp_get_user_cart_by_id(addtocart.int_user_id).ToList(); if (result.Count > 0) { if (result[0] != null) { MemoryStream memStream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); memStream.Position = 0; memStream = new MemoryStream(); byte[] strTemp = (byte[])result[0]; memStream.Write(strTemp, 0, strTemp.Length); memStream.Seek(0, SeekOrigin.Begin); Object obj = (Object)formatter.Deserialize(memStream); addtocart.listProduct = (List <Product>)obj; return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = addtocart }); } } return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "No data Found." }); } } } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "Failed to AddToCart." }); } }
public UserModel LoginUser(LoginViewModel _objLogin) { try { UserModel _login = new UserModel(); LoginUserDataAccess _objdataAccess = new LoginUserDataAccess(); _login = _objdataAccess.CheckLogin(_objLogin); return(_login); } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); throw ex; } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { var gen_ret = new CMail(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to CMail constructor!")); }
private void SetEventParams(GameObject node, CMail mail) { if (node == null || mail == null) { return; } Transform transform = node.transform.FindChild("invite_btn"); if (transform == null) { return; } CUIEventScript component = transform.GetComponent <CUIEventScript>(); if (component == null) { return; } this.SetEventParams(component, mail); }
static int _m_GetMailInfo(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CMail gen_to_be_invoked = (CMail)translator.FastGetCSObj(L, 1); { var gen_ret = gen_to_be_invoked.GetMailInfo( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public object AddToCart(AddToCartModel addtocart) { try { using (newconecommerce dataContext = new newconecommerce()) { if (addtocart.int_user_id == 0) { return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Fail, StatusMessaage = CCommon.StatusCode.Fail.ToString(), data = "Incorrect Retailer Id." }); } else { MemoryStream memStream = new MemoryStream(); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(memStream, addtocart.listProduct); byte[] arrBytes = memStream.ToArray(); memStream.Write(arrBytes, 0, arrBytes.Length); memStream.Seek(0, SeekOrigin.Begin); test(memStream.GetBuffer()); dataContext.usp_insert_shopping_cart(addtocart.int_user_id, memStream.GetBuffer()); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.Success, StatusMessaage = CCommon.StatusCode.Success.ToString(), data = "Successfully Added to Cart" }); } } } catch (Exception ex) { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); return(new ResponseModel { StatusCode = (int)CCommon.StatusCode.ExceptionOccured, StatusMessaage = CCommon.StatusCode.ExceptionOccured.ToString(), data = "Failed to AddToCart." }); } }
static int _m_SetMailInfo(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CMail gen_to_be_invoked = (CMail)translator.FastGetCSObj(L, 1); { LollipopUnity.GST.MailSt _maildata; translator.Get(L, 2, out _maildata); gen_to_be_invoked.SetMailInfo(_maildata); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public ActionResult Login(LoginViewModel model, string returnUrl) { try { if (!ModelState.IsValid) { return(View(model)); } UserModel _objlogindetails = new UserModel(); LoginUserBAL _loginbal = new LoginUserBAL(); _objlogindetails = _loginbal.LoginUser(model); if (_objlogindetails.StatusMessaage != null) { ModelState.AddModelError("", _objlogindetails.StatusMessaage); return(View(model)); } Session["strUserId"] = _objlogindetails.int_id; Session["strUserName"] = _objlogindetails.strName; Session["strEmailId"] = _objlogindetails.strEmailId; Session["strMobileNo"] = _objlogindetails.strMobileNo; return(RedirectToAction("Index", "DashBoard")); } catch (Exception ex) { if (ex.Message.Contains("That's not a valid username or password.")) { ModelState.AddModelError("", "Invalid login attempt."); return(View(model)); } else { CMail.SendSystemGeneratedMailSync(CCommon.strAdminEmailID, "TRACKING-ERROR-MAIL", ex.ToString(), CCommon.strEmailFrom, true); throw ex; } } }
public void UpdateListElenment(GameObject element, CMail mail) { int currentUTCTime = CRoleInfo.GetCurrentUTCTime(); Text component = element.transform.FindChild("Title").GetComponent <Text>(); Text component2 = element.transform.FindChild("MailTime").GetComponent <Text>(); GameObject gameObject = element.transform.FindChild("New").gameObject; GameObject gameObject2 = element.transform.FindChild("ReadMailIcon").gameObject; GameObject gameObject3 = element.transform.FindChild("UnReadMailIcon").gameObject; GameObject gameObject4 = element.transform.FindChild("CoinImg").gameObject; Text component3 = element.transform.FindChild("From").GetComponent <Text>(); CUIHttpImageScript component4 = element.transform.FindChild("HeadBg/imgHead").GetComponent <CUIHttpImageScript>(); GameObject obj = null; Text text = null; Transform transform = element.transform.FindChild("OnlineBg"); if (transform != null) { obj = transform.gameObject; } Transform transform2 = element.transform.FindChild("Online"); if (transform2 != null) { text = transform2.GetComponent <Text>(); } component.text = mail.subject; component2.text = Utility.GetTimeBeforString((long)((ulong)mail.sendTime), (long)currentUTCTime); bool flag = mail.mailState == 1; gameObject.CustomSetActive(flag); if (mail.mailType == 1) { gameObject2.CustomSetActive(!flag); gameObject3.CustomSetActive(flag); component3.text = string.Empty; component4.gameObject.CustomSetActive(false); gameObject4.SetActive(false); obj.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } } else if (mail.mailType == 2) { obj.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } gameObject2.CustomSetActive(false); gameObject3.CustomSetActive(false); component3.text = mail.from; component4.gameObject.CustomSetActive(true); if (mail.subType == 3) { gameObject4.CustomSetActive(false); component4.SetImageSprite(CGuildHelper.GetGuildHeadPath(), this.m_CUIForm); } else { gameObject4.CustomSetActive(true); if (!CSysDynamicBlock.bFriendBlocked) { COMDT_FRIEND_INFO friendByName = Singleton <CFriendContoller> .get_instance().model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (friendByName == null) { friendByName = Singleton <CFriendContoller> .get_instance().model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (friendByName != null) { string url = Utility.UTF8Convert(friendByName.szHeadUrl); component4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url)); } } } } else if (mail.mailType == 3) { obj.CustomSetActive(true); if (text != null) { text.gameObject.CustomSetActive(true); } gameObject2.CustomSetActive(false); gameObject3.CustomSetActive(false); component3.text = string.Empty; component4.gameObject.CustomSetActive(true); gameObject4.SetActive(false); Transform transform3 = element.transform.FindChild("invite_btn"); GameObject obj2 = null; if (transform3 != null) { obj2 = transform3.gameObject; } if (mail.relationType == 1) { GuildMemInfo guildMemberInfoByUid = CGuildHelper.GetGuildMemberInfoByUid(mail.uid); Singleton <CMailSys> .get_instance().AddGuildMemInfo(guildMemberInfoByUid); } this.SetEventParams(element, mail); string text2; string url2; bool flag2 = !this.GetOtherPlayerState(mail.relationType, mail.uid, mail.dwLogicWorldID, out text2, out url2); string processTypeString = this.GetProcessTypeString((CMailSys.enProcessInviteType)mail.processType); component.text = string.Format("{0} {1}", mail.subject, processTypeString); if (text != null) { text.text = text2; } component4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url2)); if (flag2) { CUIUtility.GetComponentInChildren <Image>(component4.gameObject).color = CUIUtility.s_Color_GrayShader; } else { CUIUtility.GetComponentInChildren <Image>(component4.gameObject).color = CUIUtility.s_Color_Full; } obj2.CustomSetActive(!flag2); } }
public void UpdateListElenment(GameObject element, CMail mail) { int currentUTCTime = CRoleInfo.GetCurrentUTCTime(); Text componetInChild = Utility.GetComponetInChild <Text>(element, "Title"); Text componetInChild2 = Utility.GetComponetInChild <Text>(element, "MailTime"); GameObject obj = Utility.FindChild(element, "New"); GameObject obj2 = Utility.FindChild(element, "ReadMailIcon"); GameObject obj3 = Utility.FindChild(element, "UnReadMailIcon"); GameObject obj4 = Utility.FindChild(element, "CoinImg"); Text componetInChild3 = Utility.GetComponetInChild <Text>(element, "From"); CUIHttpImageScript componetInChild4 = Utility.GetComponetInChild <CUIHttpImageScript>(element, "HeadBg/imgHead"); GameObject obj5 = null; Text text = null; GameObject gameObject = Utility.FindChild(element, "OnlineBg"); if (gameObject != null) { obj5 = gameObject.gameObject; } GameObject gameObject2 = Utility.FindChild(element, "Online"); if (gameObject2 != null) { text = gameObject2.GetComponent <Text>(); } componetInChild.set_text(mail.subject); componetInChild2.set_text(Utility.GetTimeBeforString((long)((ulong)mail.sendTime), (long)currentUTCTime)); bool flag = mail.mailState == COM_MAIL_STATE.COM_MAIL_UNREAD; obj.CustomSetActive(flag); if (mail.mailType == CustomMailType.SYSTEM) { obj2.CustomSetActive(!flag); obj3.CustomSetActive(flag); componetInChild3.set_text(string.Empty); componetInChild4.gameObject.CustomSetActive(false); obj4.CustomSetActive(false); obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } } else if (mail.mailType == CustomMailType.FRIEND) { obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(mail.from); componetInChild4.gameObject.CustomSetActive(true); if (mail.subType == 3) { obj4.CustomSetActive(false); componetInChild4.SetImageSprite(CGuildHelper.GetGuildHeadPath(), this.m_CUIForm); } else { obj4.CustomSetActive(true); if (!CSysDynamicBlock.bFriendBlocked) { COMDT_FRIEND_INFO friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (friendByName == null) { friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (friendByName != null) { string url = Utility.UTF8Convert(friendByName.szHeadUrl); componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url)); } } } } else if (mail.mailType == CustomMailType.FRIEND_INVITE) { obj5.CustomSetActive(true); if (text != null) { text.gameObject.CustomSetActive(true); } obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(string.Empty); componetInChild4.gameObject.CustomSetActive(true); obj4.CustomSetActive(false); Transform transform = element.transform.FindChild("invite_btn"); GameObject obj6 = null; if (transform != null) { obj6 = transform.gameObject; } if (mail.relationType == 1) { GuildMemInfo guildMemberInfoByUid = CGuildHelper.GetGuildMemberInfoByUid(mail.uid); Singleton <CMailSys> .instance.AddGuildMemInfo(guildMemberInfoByUid); } this.SetEventParams(element, mail); string text2; string url2; bool flag2 = !this.GetOtherPlayerState((COM_INVITE_RELATION_TYPE)mail.relationType, mail.uid, mail.dwLogicWorldID, out text2, out url2); string processTypeString = this.GetProcessTypeString((CMailSys.enProcessInviteType)mail.processType); componetInChild.set_text(string.Format("{0} {1}", mail.subject, processTypeString)); if (text != null) { text.set_text(text2); } componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url2)); if (flag2) { CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_GrayShader); } else { CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_Full); } obj6.CustomSetActive(!flag2); } else if (mail.mailType == CustomMailType.ASK_FOR) { obj2.CustomSetActive(false); obj3.CustomSetActive(false); componetInChild3.set_text(mail.from); componetInChild4.gameObject.CustomSetActive(true); obj4.CustomSetActive(false); obj5.CustomSetActive(false); if (text != null) { text.gameObject.CustomSetActive(false); } if (!CSysDynamicBlock.bFriendBlocked) { CFriendModel.FriendType friendType = CFriendModel.FriendType.GameFriend; COMDT_FRIEND_INFO friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (friendByName2 == null) { friendType = CFriendModel.FriendType.SNS; friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (friendByName2 != null) { string url3 = Utility.UTF8Convert(friendByName2.szHeadUrl); componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url3)); UT.ShowFriendData(friendByName2, element.GetComponent <FriendShower>(), FriendShower.ItemType.Normal, false, friendType, Singleton <CUIManager> .GetInstance().GetForm(CMailSys.MAIL_FORM_PATH), true); } } } }
private void Draw(CMail mail) { if (this.form != null) { Text componetInChild = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/name"); Text componetInChild2 = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/msg"); Text componetInChild3 = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/from"); if (componetInChild == null || componetInChild2 == null || componetInChild3 == null) { return; } CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { DebugHelper.Assert(false, "Master Role Info is null"); return; } componetInChild.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Mail_Ask_For_Myself"), masterRoleInfo.Name)); componetInChild2.set_text(mail.mailContent); componetInChild3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Mail_Ask_For_From", new string[] { mail.from }), new object[0])); if (mail.accessUseable == null || mail.accessUseable.Count == 0) { return; } CUseable cUseable = mail.accessUseable[0]; switch (cUseable.m_type) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(cUseable.m_baseID); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { Text component = this.form.transform.Find("Panel/Title/titleText").GetComponent <Text>(); component.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Hero_Friend_Title")); Text component2 = this.form.transform.Find("Panel/skinBgImage/skinNameText").GetComponent <Text>(); component2.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szName)); Image component3 = this.form.transform.Find("Panel/skinBgImage/skinIconImage").GetComponent <Image>(); component3.SetSprite(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref dataByKey.szImagePath), this.form, false, true, true, true); this.form.transform.Find("Panel/Panel_Prop").gameObject.CustomSetActive(false); Transform transform = this.form.transform.Find("Panel/skinPricePanel"); Transform costIcon = transform.Find("costImage"); CHeroSkinBuyManager.SetPayCostIcon(this.form, costIcon, enPayType.DianQuan); Transform costTypeText = transform.Find("costTypeText"); CHeroSkinBuyManager.SetPayCostTypeText(costTypeText, enPayType.DianQuan); uint payValue = 0u; IHeroData heroData = CHeroDataFactory.CreateHeroData(cUseable.m_baseID); ResHeroPromotion resPromotion = heroData.promotion(); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(dataByKey, resPromotion); for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++) { if (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan) { payValue = payInfoSetOfGood.m_payInfos[i].m_payValue; break; } } Transform transform2 = transform.Find("costPanel"); if (transform2) { Transform currentPrice = transform2.Find("costText"); CHeroSkinBuyManager.SetPayCurrentPrice(currentPrice, payValue); } } break; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { uint heroId = 0u; uint skinId = 0u; CSkinInfo.ResolveHeroSkin(cUseable.m_baseID, out heroId, out skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(cUseable.m_baseID); DebugHelper.Assert(heroSkin != null, "heroSkin is null"); if (heroSkin != null) { Text component4 = this.form.transform.Find("Panel/Title/titleText").GetComponent <Text>(); component4.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Skin_Friend_Title")); Image component5 = this.form.transform.Find("Panel/skinBgImage/skinIconImage").GetComponent <Image>(); string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, StringHelper.UTF8BytesToString(ref heroSkin.szSkinPicID)); component5.SetSprite(prefabPath, this.form, false, true, true, true); Text component6 = this.form.transform.Find("Panel/skinBgImage/skinNameText").GetComponent <Text>(); component6.set_text(StringHelper.UTF8BytesToString(ref heroSkin.szSkinName)); this.form.transform.Find("Panel/Panel_Prop").gameObject.CustomSetActive(true); GameObject gameObject = this.form.transform.Find("Panel/Panel_Prop/List_Prop").gameObject; CSkinInfo.GetHeroSkinProp(heroId, skinId, ref CHeroInfoSystem2.s_propArr, ref CHeroInfoSystem2.s_propPctArr, ref CHeroInfoSystem2.s_propImgArr); CUICommonSystem.SetListProp(gameObject, ref CHeroInfoSystem2.s_propArr, ref CHeroInfoSystem2.s_propPctArr); Transform transform3 = this.form.transform.Find("Panel/skinPricePanel"); Transform costIcon2 = transform3.Find("costImage"); CHeroSkinBuyManager.SetPayCostIcon(this.form, costIcon2, enPayType.DianQuan); Transform costTypeText2 = transform3.Find("costTypeText"); CHeroSkinBuyManager.SetPayCostTypeText(costTypeText2, enPayType.DianQuan); uint payValue2 = 0u; stPayInfoSet skinPayInfoSet = CSkinInfo.GetSkinPayInfoSet(heroId, skinId); for (int j = 0; j < skinPayInfoSet.m_payInfoCount; j++) { if (skinPayInfoSet.m_payInfos[j].m_payType == enPayType.Diamond || skinPayInfoSet.m_payInfos[j].m_payType == enPayType.DianQuan || skinPayInfoSet.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan) { payValue2 = skinPayInfoSet.m_payInfos[j].m_payValue; break; } } Transform transform4 = transform3.Find("costPanel"); if (transform4 != null) { Transform currentPrice2 = transform4.Find("costText"); CHeroSkinBuyManager.SetPayCurrentPrice(currentPrice2, payValue2); } } break; } } } }
public void TestMethod3() { var mail = new CMail(); //mail.SendMail(CConstValue.Approval.BusinessTrip, CConstValue.MailStatus.Approved, 1, 1762, 577, "TEST001"); }
public static string AgregarBitacora(int IdReporte, string BitacoraDescripcion, bool EnviaCorreoIntegrante, bool EnviaCorreoProveedor) { CObjeto Respuesta = new CObjeto(); CUnit.Firmado(delegate(CDB Conn) { string Error = ""; CSecurity permiso = new CSecurity(); if (permiso.tienePermiso("puedeAgregarBitacoraReporteMantenimiento")) { if (Conn.Conectado) { int IdUsuarioSesion = CUsuario.ObtieneUsuarioSesion(Conn); CObjeto Datos = new CObjeto(); CBitacora cBitacora = new CBitacora(); cBitacora.IdReporte = IdReporte; cBitacora.Bitacora = BitacoraDescripcion; cBitacora.IdUsuarioAlta = IdUsuarioSesion; cBitacora.Fecha = DateTime.Now; Error = ValidarAgregarBitacora(cBitacora); if (Error == "") { //cBitacora.Agregar(Conn); //EnviarCorreo if (EnviaCorreoProveedor == true || EnviaCorreoIntegrante == true) { string To = ""; string Cc = ""; string Bcc = ""; string id = ""; string folio = ""; string fechalevantamiento = ""; string pais = ""; string estado = ""; string municipio = ""; string sucursal = ""; string medidor = ""; string tablero = ""; string circuito = ""; string descripcionCircuito = ""; string tipoConsumo = ""; string responsable = ""; string lugar = ""; string correoproveedor = ""; string correoresponsable = ""; string correos = ""; string spReporte = "EXEC sp_Reporte_Consultar @Opcion"; Conn.DefinirQuery(spReporte); Conn.AgregarParametros("@Opcion", 1); CObjeto oMeta = Conn.ObtenerRegistro(); id = oMeta.Get("IdReporte").ToString(); folio = oMeta.Get("Folio").ToString(); fechalevantamiento = oMeta.Get("FechaLevantamiento").ToString(); pais = oMeta.Get("Pais").ToString(); estado = oMeta.Get("Estado").ToString(); municipio = oMeta.Get("Municipio").ToString(); sucursal = oMeta.Get("Sucursal").ToString(); medidor = oMeta.Get("Medidor").ToString(); tablero = oMeta.Get("Tablero").ToString(); circuito = oMeta.Get("Circuito").ToString(); descripcionCircuito = oMeta.Get("DescripcionCircuito").ToString(); tipoConsumo = oMeta.Get("TipoConsumo").ToString(); responsable = oMeta.Get("Responsable").ToString(); correoproveedor = oMeta.Get("CorreoProveedor").ToString(); correoresponsable = oMeta.Get("CorreoResponsable").ToString(); string spCorreos = "EXEC sp_Usuario_ConsultarCorreos @Opcion, @IdReporte"; Conn.DefinirQuery(spCorreos); Conn.AgregarParametros("@Opcion", 1); Conn.AgregarParametros("@IdReporte", IdReporte); SqlDataReader Obten = Conn.Ejecutar(); if (Obten.HasRows) { while (Obten.Read()) { correos = correos + Obten["Correo"].ToString() + ";"; } } Obten.Close(); if (correos != "") { correos = correos.Substring(0, correos.Length - 1); } if (EnviaCorreoProveedor == true && EnviaCorreoIntegrante == true) { To = correoproveedor; Cc = correos; } else { if (EnviaCorreoProveedor == true && EnviaCorreoIntegrante == false) { To = correoproveedor; Cc = correoresponsable; } else { if (EnviaCorreoProveedor == false && EnviaCorreoIntegrante == true) { To = correos; } } } Bcc = ""; lugar = municipio + ' ' + estado + ' ' + pais; string html = ""; string thisEnter = "\r\n"; string separador = HttpContext.Current.Request.UrlReferrer.ToString(); string pagina = separador.Substring(0, separador.LastIndexOf("/") + 1); string URLCorreo = pagina; html = html + thisEnter + "<html>"; html = html + thisEnter + "<head></head>"; html = html + thisEnter + "<body>"; html = html + thisEnter + "<table>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td style='text-align: center; background-color: #f5f5f5;' colspan='4'><strong>Detalle</strong></td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td><strong>Fecha levantamiento</strong></td>"; html = html + thisEnter + "<td>" + fechalevantamiento + "</td>"; html = html + thisEnter + "<td><strong>Responsable</strong></td>"; html = html + thisEnter + "<td>" + responsable + "</td>"; html = html + thisEnter + " </tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td><strong>Lugar</strong></td>"; html = html + thisEnter + "<td>" + lugar + "</td>"; html = html + thisEnter + "<td><strong>Sucursal</strong></td>"; html = html + thisEnter + "<td>" + sucursal + "</td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td><strong>Medidor</strong></td>"; html = html + thisEnter + "<td>" + medidor + "</td>"; html = html + thisEnter + "<td><strong>Tablero</strong></td>"; html = html + thisEnter + "<td>" + tablero + "</td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td><strong>Circuito</strong></td>"; html = html + thisEnter + "<td>" + circuito + "</td>"; html = html + thisEnter + "<td><strong>Descripcion</strong></td>"; html = html + thisEnter + "<td>" + descripcionCircuito + "</td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td><strong>Tipo Consumo</strong></td>"; html = html + thisEnter + "<td>" + tipoConsumo + "</td>"; html = html + thisEnter + "<td><strong>Consumo por día</strong></td>"; html = html + thisEnter + "<td></td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td style='text-align: center; background-color: #f5f5f5;' colspan='4'><strong>Comentario</strong></td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "<tr>"; html = html + thisEnter + "<td colspan='4'>" + BitacoraDescripcion + "</td>"; html = html + thisEnter + "</tr>"; html = html + thisEnter + "</table>"; html = html + thisEnter + "<br/><br/>Favor de iniciar sesión para dar seguimiento <a name='aceptar' href='" + URLCorreo + "' class='enlaceboton' style='text-decoration: none' title=' Ir a sitio web '>Visitar sitio</a> "; html = html + thisEnter + "</body>"; html = html + thisEnter + "</html>"; CMail.EnviarCorreo("*****@*****.**", To, Cc, Bcc, "Asunto", html); } } Respuesta.Add("Datos", Datos); } else { Error = Error + "<li>" + Conn.Mensaje + "</li>"; } } else { Error = Error + "<li>No tienes los permisos necesarios</li>"; } Respuesta.Add("Error", Error); }); return(Respuesta.ToString()); }
public int AddUser(UserModels model, out string msg) { int ret = 0; STUser data = new STUser(); msg = null; CCondition clCondition = new CCondition(); CPermission clPermission = new CPermission(); try { CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); ret = clUser.GetRecordByUserLogin(model.Login, out data, out msg); if (ret != 0) { return(ret); } else { if (data.login != null) { msg = "The login already exists in the database for the application."; return(1); } } data.comments = model.Comments; data.activateddate = null; data.condition = 0; data.creationdate = DateTime.Now; data.email = model.Email; data.isactivated = false; data.login = model.Login; data.modifieddate = data.creationdate; data.owneruserid = LocalData.UserId(); // data.passwordsalt = CreateSalt(); // data.password = CreatePasswordHash(model.Password, data.passwordsalt); data.permission = clPermission.GetId(model.Permission); data.username = model.UserName; data.passvaliddate = DateTime.Now.AddDays(-1); data.newemailkey = GenerateKey(); string[] arr = new[] { "'", "\"", "--" }; if (CheckerField.CheckField(arr, data.comments, data.email, data.login, data.username)) { msg = "One or more fields contain invalid characters."; return(2); } ret = clUser.Insert(data, out msg); if (ret == 0) { CAction clAction = new CAction(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); clAction.AddAction(ActionType.AddUser, string.Format("Add user {0}, {1}", data.username, data.login), out msg); CMail clMail = new CMail(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); STMail maildata = new STMail(); maildata.to = data.email; maildata.tamplate = "MailToUserActivateAccount.txt"; maildata.linkkey = data.newemailkey; maildata.fleetpwd = null; maildata.pan = null; maildata.dtcreate = DateTime.Now.ToString("yyyyMMddHHmmss"); maildata.dtmistsent = null; maildata.login = data.login; clMail.Insert(maildata, out msg); SMTPNotice smtp = new SMTPNotice(LocalData.SmtpHost(), LocalData.SmtpPort(), LocalData.SmtpUseSSL(), LocalData.SmtpUserName(), LocalData.SmtpPassword(), LocalData.SmtpFrom(), LocalData.CSDbUsers(), LocalData.LogPath(), LocalData.GetTemplatePath(), LocalData.Images()); smtp.SendNotice(out msg); } } catch (Exception ex) { msg = ex.Message; ret = -1; } return(ret); }
public void UpdateListElenment(GameObject element, CMail mail) { int currentUTCTime = CRoleInfo.GetCurrentUTCTime(); Text component = element.transform.FindChild("Title").GetComponent <Text>(); Text text2 = element.transform.FindChild("MailTime").GetComponent <Text>(); GameObject gameObject = element.transform.FindChild("New").gameObject; GameObject obj3 = element.transform.FindChild("ReadMailIcon").gameObject; GameObject obj4 = element.transform.FindChild("UnReadMailIcon").gameObject; GameObject obj5 = element.transform.FindChild("CoinImg").gameObject; Text text3 = element.transform.FindChild("From").GetComponent <Text>(); CUIHttpImageScript script = element.transform.FindChild("HeadBg/imgHead").GetComponent <CUIHttpImageScript>(); component.text = mail.subject; text2.text = Utility.GetTimeBeforString((long)mail.sendTime, (long)currentUTCTime); bool bActive = mail.mailState == COM_MAIL_STATE.COM_MAIL_UNREAD; gameObject.CustomSetActive(bActive); if (mail.mailType == COM_MAIL_TYPE.COM_MAIL_SYSTEM) { obj3.CustomSetActive(!bActive); obj4.CustomSetActive(bActive); text3.text = string.Empty; script.gameObject.CustomSetActive(false); obj5.SetActive(false); } else if (mail.mailType == COM_MAIL_TYPE.COM_MAIL_FRIEND) { obj3.CustomSetActive(false); obj4.CustomSetActive(false); text3.text = mail.from; script.gameObject.CustomSetActive(true); if (mail.subType == 3) { obj5.CustomSetActive(false); script.SetImageSprite(CGuildHelper.GetGuildHeadPath(), this.m_CUIForm); } else { obj5.CustomSetActive(true); if (!CSysDynamicBlock.bFriendBlocked) { COMDT_FRIEND_INFO comdt_friend_info = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (comdt_friend_info == null) { comdt_friend_info = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (comdt_friend_info != null) { string url = Utility.UTF8Convert(comdt_friend_info.szHeadUrl); script.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url)); } } } } else if (mail.mailType == COM_MAIL_TYPE.COM_MAIL_FRIEND_INVITE) { obj3.CustomSetActive(false); obj4.CustomSetActive(false); text3.text = string.Empty; script.gameObject.CustomSetActive(true); obj5.SetActive(false); if (!CSysDynamicBlock.bFriendBlocked) { COMDT_FRIEND_INFO comdt_friend_info2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend); if (comdt_friend_info2 == null) { comdt_friend_info2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS); } if (comdt_friend_info2 != null) { string str2 = Utility.UTF8Convert(comdt_friend_info2.szHeadUrl); script.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(str2)); } } } }