public Repository() { _client.DefaultRequestHeaders.Accept.Clear(); _client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); _loginToken = (LoginSession)HttpContext.Current.Session ["token"]; _thisPerson = (Person)HttpContext.Current.Session ["person"]; //_client.DefaultRequestHeaders.Add("Authorization", Repository.Token); }
/// <summary> /// Renews a LoginSession and replaces an already existing session. /// </summary> /// <param name="context">DataContext</param> /// <param name="session">LoginSession</param> /// <param name="person">Person (user)</param> /// <returns>LoginSession</returns> public static LoginSession RenewSession(DataContext context,LoginSession session,Person person) { session = new LoginSession (Guid.NewGuid ().ToString (), DateTime.Now); if (person.LoginSession != null) context.LoginSessions.Remove (person.LoginSession); person.LoginSession = session; context.SaveChanges(); return session; }
public ActionResult Index(BAL.ForgotPwd model) { if (this.IsCaptchaValid("Captcha is not valid")) { if (ModelState.IsValid) { MembershipUser _user; _user = System.Web.Security.Membership.GetUser(model.UserID, false); if (_user != null) { try { String IpAddress = ControllerContext.HttpContext.Request.UserHostAddress; // Request.ServerVariables["REMOTE_ADDR"];// System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; if (IpAddress != null) { model.ResetIpAddress = IpAddress; } LoginSession loginSession = new LoginSession(); loginSession = BAL.BALLoginSessionModels.LoginDetails(model.UserID); if (loginSession.UserID != null) { model.CreateBy = loginSession.UserID.ToString(); } if (RegistrationModels.PasswordReset(model)) { ResetPassword(model.UserID); ViewBag.ErrMessage = "Thank you for Submitting your Email address. Your password rest link is send to your Email.Please login to your Email account and follow the step to reset your password."; } else { ViewBag.ErrMessage = "Try Again.."; } } catch (Exception ex) { ViewBag.ErrMessage = "Error:" + ex.Message; } } else { ViewBag.ErrMessage = "Email address is not registered with mysycous.com"; } } else { ViewBag.ErrMessage = "Error: Eamil Address is not valid."; } } else { ViewBag.ErrMessage = "Error: captcha is not valid."; } return View(); }
protected void ImageButtonLogin_Click(object sender, ImageClickEventArgs e) { AccessControl ac = new AccessControl(); if (!ac.getSectionAccess("Login")) { LabelLoginError.Text = "با عرض پوزش ورود به سیستم موقتاً در سایت غیر فعال می باشد."; LabelLoginError.Visible = true; } else { string loginEmail = TextBoxLoginEmail.Text; MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); Byte[] PassByte; UTF8Encoding encoder = new UTF8Encoding(); PassByte = md5Hasher.ComputeHash(encoder.GetBytes(TextBoxLoginPassword.Text)); var query = context.Users.Where(u => u.Email == loginEmail && u.Password == PassByte).SingleOrDefault(); if (query != null) { LabelLoginError.Visible = false; Session["UserId"] = query.UserId; int Hours = 2; string VerificationCode = Convert.ToString(Guid.NewGuid()); if (CheckBoxLoginRemember.Checked) { Hours = 168; } LoginSession ls = new LoginSession(); ls.setLoginSession(Convert.ToInt32(query.UserId), VerificationCode, Hours); HttpCookie _userInfoCookies = new HttpCookie("VC"); _userInfoCookies["VC"] = VerificationCode; _userInfoCookies.Expires = DateTime.Now.AddHours(Hours); Response.Cookies.Add(_userInfoCookies); query.LastLogin = DateTime.Now; context.SubmitChanges(); Response.Redirect("~/Panel.aspx"); } else { LabelLoginError.Visible = true; } } }
public MsCrmResult ConfirmForm(string token, int formCode) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { _sda = new SqlDataAccess(); _sda.openConnection(Globals.ConnectionString); #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion MsCrmResultObject resultFormInfo = DiscoveryFormHelper.GetDiscoveryFormInfo(formCode, _sda); if (resultFormInfo.Success) { DiscoveryForm formInfo = (DiscoveryForm)resultFormInfo.ReturnObject; formInfo.Status = new OptionSetValueWrapper() { AttributeValue = (int)DiscoveryFormStatus.LotusConfirmed }; } else { returnValue.Result = resultFormInfo.Result; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public MsCrmResult AnswerSurvey(string token, SurveyAnswer answer) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); returnValue = SurveyHelper.AnswerSurvey(answer, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-AnswerSurvey"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { #region if (LoginSession.IsLogin()) { if (!LoginSession.IsAdmin()) { if (!LoginSession.IsView("MN-00011")) { Response.Redirect("NoPermitsion.aspx"); } } } else { Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery); } hidUserName.Value = LoginSession.UserName(); #endregion #region string CodeDocument = Convert.ToString(Request.QueryString["CodeDocument"]); string DocNo = Convert.ToString(Request.QueryString["DocNo"]); string CancelDocument = Convert.ToString(Request.QueryString["CancelDocument"]); CategorysMN aCategorysMN = new CategorysMN(); ListItem aListItem = new ListItem(); string CatTypeCode = string.Empty; CatTypeCode = "CT-00003"; //Application Site ddlApplicationSite.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); ddlApplicationSite.DataValueField = "CatCode"; ddlApplicationSite.DataTextField = "CatName"; ddlApplicationSite.DataBind(); //CatTypeCode = "CT-00007"; //Type of closing application //ddlCloseDocument.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); //ddlCloseDocument.DataValueField = "CatCode"; //ddlCloseDocument.DataTextField = "CatName"; //ddlCloseDocument.DataBind(); UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN(); #endregion #region RegisterCancelSecurityMN aRegisterCancelDocumentMN = new RegisterCancelSecurityMN(); if (!String.IsNullOrEmpty(CodeDocument) && !String.IsNullOrEmpty(DocNo)) { #region ddlDepartment.DataSource = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName()); ddlDepartment.DataValueField = "Department"; ddlDepartment.DataTextField = "NameDepartment"; ddlDepartment.DataBind(); DataTable aData = aRegisterCancelDocumentMN.ListDocmentRefByCodeDocumentAndCodeDCC(CodeDocument, DocNo); txtApplicationName.Text = LoginSession.FullName(); txtApplicationNO.Text = string.Empty; txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); if (aData.Rows.Count > 0) { aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"])); if (aListItem != null) { ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]); } txtApplicationNo_DCC.Text = Convert.ToString(aData.Rows[0]["CodeDocument"]); txtDocNo_DCC.Text = Convert.ToString(aData.Rows[0]["DocNo"]); txtNameFile.Text = Convert.ToString(aData.Rows[0]["DocName"]); //txtAssignedRevisor.Text = Convert.ToString(aData.Rows[0]["AssignedRevisor"]); txtEstimatedCloseData.Text = Convert.ToString(aData.Rows[0]["EstimatedCloseDate"]); } #endregion } else if (!String.IsNullOrEmpty(CancelDocument)) { #region DataTable aData = aRegisterCancelDocumentMN.ListRegisterCancelDocument(CancelDocument, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01")); if (aData.Rows.Count > 0) { ddlDepartment.DataSource = aUserInDepartmentMN.ListDepartmentByUserName(Convert.ToString(aData.Rows[0]["CreatedBy"])); ddlDepartment.DataValueField = "Department"; ddlDepartment.DataTextField = "NameDepartment"; ddlDepartment.DataBind(); hidID.Value = Convert.ToString(aData.Rows[0]["ID"]); hidCancelDocument.Value = Convert.ToString(aData.Rows[0]["CancelDocument"]); hidStates.Value = Convert.ToString(aData.Rows[0]["States"]); txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]); txtApplicationNO.Text = Convert.ToString(aData.Rows[0]["CancelDocument"]); txtApplicationDate.Text = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss"); aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"])); if (aListItem != null) { ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]); } txtEffectiveDate.Text = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty; //aListItem = ddlCloseDocument.Items.FindByValue(Convert.ToString(aData.Rows[0]["CloseDocument"])); //if (aListItem != null) //{ // ddlCloseDocument.SelectedValue = Convert.ToString(aData.Rows[0]["CloseDocument"]); //} txtApplicationNo_DCC.Text = Convert.ToString(aData.Rows[0]["ApplicationNo_Code"]); txtDocNo_DCC.Text = Convert.ToString(aData.Rows[0]["DocNo"]); txtNameFile.Text = Convert.ToString(aData.Rows[0]["DocName"]); //txtAssignedRevisor.Text = Convert.ToString(aData.Rows[0]["AssignedRevisor"]); txtEstimatedCloseData.Text = Convert.ToString(aData.Rows[0]["EstimatedCloseDate"]); txtReasonApplication.Text = Convert.ToString(aData.Rows[0]["ReasonOfApplication"]); aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"])); if (aListItem != null) { ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]); } } #endregion } #endregion } } catch (Exception ex) { ex.ToString(); } }
public async Task <bool> Logout(LoginSession session) { return(await _userLoginInfoRepository.Logout(session.Email, session.Token, session.DeviceName)); }
public MsCrmResult LogVideo(string token, string videoId) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); returnValue = VideoHelper.LogVideo(ls.PortalUserId, ls.PortalId, new Guid(videoId), service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-LogVideo"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-LogVideo"; } finally { } return returnValue; }
public string HasUserRequestWithYou(string token, string selectedUserId) { MsCrmResultObject returnValue = new MsCrmResultObject(); LoginSession ls = new LoginSession(); JavaScriptSerializer ser = new JavaScriptSerializer(); string json = string.Empty; try { if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(selectedUserId)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { json = ser.Serialize(sessionResult); return json; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = FriendshipHelper.HasUserRequestWithYou(ls.PortalId, ls.PortalUserId, new Guid(selectedUserId), sda); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-HasUserRequestWithYou"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-HasUserRequestWithYou"; } finally { if (sda != null) { sda.closeConnection(); } } json = ser.Serialize(returnValue); return json; }
public MsCrmResult SaveDiscoveryForm(string token, DiscoveryForm discForm) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion #region | VALIDATION | if (string.IsNullOrEmpty(discForm.FirstName)) { returnValue.Result = "Ad alanı boş olamaz"; return returnValue; } if (string.IsNullOrEmpty(discForm.LastName)) { returnValue.Result = "Soyadı alanı boş olamaz"; return returnValue; } if (string.IsNullOrEmpty(discForm.PhoneNumber)) { returnValue.Result = "Telefon Numarası alanı boş olamaz"; return returnValue; } if (string.IsNullOrEmpty(discForm.Email)) { returnValue.Result = "Email alanı boş olamaz"; return returnValue; } if (discForm.CityId == null || discForm.CityId.Id == Guid.Empty) { returnValue.Result = "İl alanı boş olamaz"; return returnValue; } if (discForm.TownId == null || discForm.TownId.Id == Guid.Empty) { returnValue.Result = "İlçe alanı boş olamaz"; return returnValue; } //if (discForm.HomeType == null || discForm.HomeType.AttributeValue == null || discForm.HomeType.AttributeValue == 0) //{ // returnValue.Result = "Konut Tipi alanı boş olamaz"; // return returnValue; //} //if (discForm.VisitDate == null) //{ // returnValue.Result = "En Uygun Tarih alanı boş olamaz"; // return returnValue; //} //if (discForm.VisitHour == null || discForm.VisitHour.AttributeValue == null || discForm.VisitHour.AttributeValue == 0) //{ // returnValue.Result = "En Uygun Saat alanı boş olamaz"; // return returnValue; //} //if (discForm.InformedBy == null || discForm.InformedBy.AttributeValue == null || discForm.InformedBy.AttributeValue == 0) //{ // returnValue.Result = "Kale 7/24'ü nereden duydunuz? alanı boş olamaz"; // return returnValue; //} #endregion IOrganizationService service = MSCRM.GetOrgService(true); sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); discForm.Name = discForm.UserId.Name + "|" + DateTime.Now.ToString("dd.MM.yyyy HH:mm"); returnValue = DiscoveryFormHelper.CreateDiscoveryForm(discForm, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public string GetExtListName(LoginSession session, String server, Int32 list) { string result = _adcSrv.GetExtListName(server, list); return(result); }
public MsCrmResult CompleteRequest(string token, string requestId) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token) || !string.IsNullOrEmpty(requestId)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); AssemblyRequestInfo req = new AssemblyRequestInfo() { Id = new Guid(requestId), StatusCode = new OptionSetValueWrapper() { AttributeValue = (int)AssemblyRequestStatus.Completed } }; returnValue = AssemblyRequestHelper.UpdateAssemblyRequest(req, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!"; } } catch (Exception ex) { returnValue.Result = ex.Message; } finally { if (sda != null) { sda.closeConnection(); } } return returnValue; }
public MsCrmResult UsePointCode(string token, string pointCode) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); MsCrmResultObject resultGetPointCodeInfo = PointCodeHelper.GetPointCodeInfo(pointCode, sda); if (resultGetPointCodeInfo.Success) { PointCode pCode = resultGetPointCodeInfo.GetReturnObject<PointCode>(); if (pCode.Status.AttributeValue == 1) //Etkin ise { returnValue = PointCodeHelper.PassiveCode(pCode.Id, service); if (returnValue.Success) { UserCodeUsage userCodeUsage = new UserCodeUsage(); userCodeUsage.Name = pointCode; userCodeUsage.Point = pCode.Point; userCodeUsage.PointCodeId = new EntityReferenceWrapper() { Id = pCode.Id, Name = pCode.Name, LogicalName = "new_pointcode" }; userCodeUsage.PortalId = new EntityReferenceWrapper() { Id = ls.PortalId, LogicalName = "new_portal" }; userCodeUsage.UserId = new EntityReferenceWrapper() { Id = ls.PortalUserId, LogicalName = "new_user" }; returnValue = PointCodeHelper.CreateUserCodeUsage(userCodeUsage, service); Score sc = new Score() { Point = pCode.Point, Portal = userCodeUsage.PortalId.ToCrmEntityReference(), User = userCodeUsage.UserId.ToCrmEntityReference(), ScoreType = ScoreType.PointCode }; MsCrmResult scoreRes = ScoreHelper.CreateScore(sc, service); } } else { returnValue.Result = "Girmiş olduğunuz kod önceden kullanılmıştır."; } } else { returnValue.Result = resultGetPointCodeInfo.Result; } } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-CreateForumSubject"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public MsCrmResult CreateForumSubject(string token, ForumSubject forumSubject) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); forumSubject.Portal = new EntityReference("new_portal", ls.PortalId); returnValue = ForumHelper.CreateForumSubject(forumSubject, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-CreateForumSubject"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public MsCrmResult UpdateMyProfile(string token, string newPassword, string oldPassword, Contact contact) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token) && contact != null) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = ContactHelper.CreateOrUpdateProfile(contact, service); if (!string.IsNullOrEmpty(newPassword) && !string.IsNullOrEmpty(oldPassword)) { returnValue = PortalUserHelper.UpdateUserPassword(ls.PortalUserId, newPassword, oldPassword, service, sda); if (returnValue.Success) { returnValue.Result = "M012"; //"Profile bilgileriniz ve " + returnValue.Result; } } } else { returnValue.Success = false; returnValue.Result = "M003"; //"Kulanıcı bilgisi boş!-UpdateMyProfile"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-UpdateMyProfile"; } finally { if (sda != null) { sda.closeConnection(); } } return returnValue; }
public MsCrmResult UpdateWelcomePageGenerated(string token) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); returnValue = PortalUserHelper.UpdateWelcomePageGenerated(ls.PortalUserId, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-UpdateWelcomePageGenerated"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public MsCrmResult SetUserSession(string token, Guid portalId, Guid portalUserId) { MsCrmResult returnValue = new MsCrmResult(); try { LoginSession ls = new LoginSession() { Token = token, PortalId = portalId, PortalUserId = portalUserId }; HttpContext.Current.Session.Add(token, ls); returnValue.Success = true; returnValue.Result = "Oturum bilgileri işlendi"; } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public string SelectSurvey(string token) { MsCrmResultObject returnValue = new MsCrmResultObject(); LoginSession ls = new LoginSession(); JavaScriptSerializer ser = new JavaScriptSerializer(); string json = string.Empty; try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { json = ser.Serialize(sessionResult); return json; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = SurveyHelper.SelectSurvey(ls.PortalId, ls.PortalUserId, sda); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-SelectSurvey"; } } catch (Exception ex) { returnValue.Result = ex.Message; } json = ser.Serialize(returnValue); return json; }
public List<SelectValue> SearchUserTokenize(string token, string search) { List<SelectValue> selectValues = null; LoginSession loginSession = new LoginSession(); try { try { if (!string.IsNullOrEmpty(token)) { MsCrmResultObject userSession = this.GetUserSession(token); if (userSession.Success) { loginSession = (LoginSession)userSession.ReturnObject; sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); string str = loginSession.PortalId.ToString(); Guid portalUserId = loginSession.PortalUserId; selectValues = FriendshipHelper.SearchFriend(str, portalUserId.ToString(), search, sda); } else { return selectValues; } } } catch (Exception ex) { } } finally { if (sda != null) { sda.closeConnection(); } } return selectValues; }
private void ClearDoneEventsAfterMove(LoginSession session, String server, Int32 list, IEnumerable <EventEventIdPair> events) { var clearDoneEvent = events.Where(item => item.ADCEvent.EventStatus.Contains(EventRunStatus.Done)).Select(item => item.ADCEventId).ToList(); PerformEventsClearDone(session, server, list, clearDoneEvent); }
public Boolean DeleteEvent(LoginSession session, String server, Int32 list, Guid position) { CheckListLock(server, list); return(_adcSrv.DeleteEvents(server, list, position, 1)); }
public IEnumerable <EventDTO> GetList(LoginSession session, String server, int list) { return(_adcSrv.GetEventsList(server, list).Select(pair => pair.ToDTO()).ToList()); }
public void GangPlayGang(LoginSession session, String server, IEnumerable <Int32> lists) { _adcSrv.GangPlayGang(server, lists); }
public IEnumerable <ListStateValue> GetListState(LoginSession session, String server, Int32 list) { IEnumerable <ListStateValue> result = _adcSrv.GetListState(server, list); return(result); }
public MsCrmResult SaveGraffiti(string token, Graffiti graffiti) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (graffiti.HasMedia == false && (string.IsNullOrWhiteSpace(graffiti.Description))) { returnValue.Result = "Duvar yazısı paylaşmak için içerik veya resim içeriği eklemelisiniz."; return returnValue; } if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); returnValue = GraffitiHelper.SaveOrUpdateGraffiti(graffiti, service); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-SaveGraffiti"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-SaveGraffiti"; } return returnValue; }
public void GangAirProtect(LoginSession session, String server, IEnumerable <Int32> lists) { _adcSrv.GangAirProtect(server, lists); }
/// <summary> /// Refreshes a LoginSession such that the login token won't expire. /// </summary> /// <param name="context">DataContext</param> /// <param name="session">LoginSession</param> public static void UpdateLoginSession(DataContext context,LoginSession session) { session.LastUpdatedDateTime = DateTime.Now; context.SaveChanges(); }
private void GetNavigationCommandFactory(string ownerUserTag, string roomName, string userTag, LoginSession loginSession, Action <TestExecResult> callback) { _localUserVm.UserTag = userTag; _localUserVm.LoginSession = loginSession; _roomVm.UserTag = ownerUserTag; _roomVm.RoomName = roomName; var navCommandFactory = new JoinRoomController(_roomService, _viewModelFactory); Action <string, string> navigationRequiredCallback = (cbOwnerUserTag, cbRoomName) => Try(() => { Assert.IsFalse(string.IsNullOrEmpty(cbOwnerUserTag), "The Owner must not be null."); Assert.IsFalse(string.IsNullOrEmpty(cbRoomName), "The Room must not be null."); if (callback != null) { callback(TestExecResult.RenavigationRequired); } }); OperationCallback joinRoomCallback = ex => Try(() => { Assert.IsNull(ex, "The JoinRoomController threw an exception: " + ex); Assert.IsNotNull(_roomVm.UserVm.Model, "The Owner must not be null."); Assert.IsNotNull(_roomVm.Model, "The Room must not be null."); Assert.IsNotNull(_localUserVm.Model, "The User must not be null."); Assert.AreEqual(_roomVm.UserTag, _roomVm.UserVm.Model.UserTag); Assert.AreEqual(_roomVm.RoomName, _roomVm.Model.Name); Assert.AreEqual(_roomVm.UserVm.Model.UserId, _roomVm.Model.User.UserId); Assert.AreEqual(_localUserVm.UserId, _localUserVm.Model.UserId); if (callback != null) { callback(TestExecResult.ExecutionCompleted); } }); navCommandFactory.Execute(navigationRequiredCallback, joinRoomCallback); }
protected abstract Task Process(LoginSession client, T packet);
public MsCrmResult CreateFriendshipRequest(string token, FriendshipRequest request) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-CreateFriendshipRequest"; } IOrganizationService service = MSCRM.GetOrgService(true); returnValue = FriendshipHelper.CreateFriendshipRequest(request, service); } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return returnValue; }
public MsCrmResult SaveAnswer(string token, Answer answer) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); IOrganizationService service = MSCRM.GetOrgService(true); if (!answer.IsRefreshOrBack && !answer.IsTimeOverlap && answer.Choice != null && answer.Choice.Id != Guid.Empty) { List<QuestionChoices> choices = (List<QuestionChoices>)QuestionHelper.GetQuestionChoices(answer.Question.Id, sda).ReturnObject; var query = (from a in choices where a.IsCorrect == true && a.Id == answer.Choice.Id select a).ToList(); if (query.Count > 0) { answer.IsCorrect = true; } else { answer.IsCorrect = false; } } returnValue = AnswerHelper.SaveOrUpdateAnswer(answer, service); if (returnValue.Success) { if (!answer.IsRefreshOrBack && !answer.IsTimeOverlap && answer.Choice != null && answer.Choice.Id != Guid.Empty) { if (answer.IsCorrect) { returnValue.Result = "Cevabınız doğru " + (answer.IsTrust ? (2 * answer.Point).ToString() : answer.Point.ToString()) + " puan kazandınız!"; } else { returnValue.Success = false; returnValue.Result = "Cevabınız yanlış.<br /><strong>" + (answer.IsTrust ? answer.Point.ToString() + " puan kaybettiniz." : string.Empty) + "</strong>"; } } else { returnValue.Success = false; returnValue.Result = (answer.IsTimeOverlap ? "<p>Zaman doldu!<br /><strong>" : "Sayfadan çıktınız!<br /><strong>") + (answer.IsTrust ? answer.Point.ToString() + " puan kaybettiniz." : string.Empty) + "</strong></p>"; } } } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-SaveAnswer"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-SaveAnswer"; } finally { if (sda != null) sda.closeConnection(); } return returnValue; }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; LoginSession ls = new LoginSession(); int UserId = ls.getUserId(VC); if (UserId == 0) { PanelUser.Visible = false; PanelLogin.Visible = true; PanelTop.Visible = true; Session.Remove("UserId"); Response.Cookies.Remove("VC"); } else { Session["UserId"] = UserId.ToString(); loginTrue(); } } else { PanelUser.Visible = false; PanelLogin.Visible = true; PanelTop.Visible = true; Session.Remove("UserId"); Response.Cookies.Remove("VC"); } if (!IsPostBack) { AccessControl ac = new AccessControl(); if (!ac.getSectionAccess("General")) { Response.Redirect("~/NoAccess.aspx"); } HyperLinkPageFlip.NavigateUrl = "~/Offers.aspx"; HyperLinkPageFlip.ImageUrl = "~/_shared/jQuery/PageFlip/page_flip.png"; //get keywords & descriptions DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_seoInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; Page.MetaKeywords = dt.Rows[0]["SeoKeywords"].ToString(); Page.MetaDescription = dt.Rows[0]["SeoDescriptions"].ToString(); sda.Dispose(); sqlConn.Close(); //getMainSectionsLinksCode LiteralSectionsLinks.Text = ac.getMainSectionsLinksCode(Path.GetFileName(Request.Path)); LiteralSectionsFooter.Text = ac.getMainSectionsFooterCode(Path.GetFileName(Request.Path)); //Location&Language Menu DataTable dtLocations = new DataTable(); DataTable dtLanguages = new DataTable(); DataSet dsLocations = new DataSet(); SqlDataAdapter sdaLocations = new SqlDataAdapter("sp_LocationsAndLanguagesList", sqlConn); sdaLocations.SelectCommand.CommandType = CommandType.StoredProcedure; sdaLocations.Fill(dsLocations); dtLocations = dsLocations.Tables[0]; dtLanguages = dsLocations.Tables[1]; for (int i = 0; i < dtLocations.Rows.Count; i++) { MenuItem newItem = new MenuItem(); newItem.NavigateUrl = "~/Pages/ChangeLocation.aspx?Mode=Location&LocationId=" + dtLocations.Rows[i]["LocationId"].ToString() + "&LocationName=" + dtLocations.Rows[i]["LocationName"].ToString(); newItem.Text = dtLocations.Rows[i]["LocationName"].ToString(); MenuLocations.Items[0].ChildItems.Add(newItem); } //for (int i = 0; i < dtLanguages.Rows.Count; i++) //{ // MenuItem newItem = new MenuItem(); // newItem.NavigateUrl = "~/Pages/ChangeLocation.aspx?Mode=Language&LanguageId=" + dtLanguages.Rows[i]["LanguageId"].ToString() + "&LanguageName=" + dtLanguages.Rows[i]["LanguageName"].ToString(); // newItem.Text = dtLanguages.Rows[i]["LanguageName"].ToString(); // MenuLanguages.Items[0].ChildItems.Add(newItem); //} LabelLocation.Text = "موقعیت: سراسری"; //try //{ // if (HttpContext.Current.Request.Cookies["Location"] != null) // { // LabelLocation.Text = "موقعیت: " + Request.Cookies["Location"].Values["LocationName"]; // } // else // { // HttpCookie _locationCookies = new HttpCookie("Location"); // _locationCookies["LocationId"] = "0"; // _locationCookies["LocationName"] = "سراسری"; // _locationCookies.Expires = DateTime.Now.AddYears(1); // Response.Cookies.Add(_locationCookies); // LabelLocation.Text = "موقعیت: " + Request.Cookies["Location"].Values["LocationName"]; // } //} //catch (Exception) //{ //} //try //{ // if (HttpContext.Current.Request.Cookies["Language"] != null) // { // LabelLanguage.Text = "زبان: " + Request.Cookies["Language"].Values["LanguageName"]; // } // else // { // HttpCookie _LanguageCookies = new HttpCookie("Language"); // _LanguageCookies["LanguageId"] = "FA"; // _LanguageCookies["LanguageName"] = "فارسی"; // _LanguageCookies.Expires = DateTime.Now.AddYears(1); // Response.Cookies.Add(_LanguageCookies); // LabelLanguage.Text = "زبان: " + Request.Cookies["Language"].Values["LanguageName"]; // } //} //catch (Exception) //{ //} } }
public MessageInfo CreateMessage(string token, MessageInfo message) { message.Content = System.Uri.UnescapeDataString(message.Content); message.Name = System.Uri.UnescapeDataString(message.FromId.Name) + "|" + System.Uri.UnescapeDataString(message.ToId.Name); MessageInfo messageInfo = new MessageInfo(); LoginSession loginSession = new LoginSession(); try { try { if (!string.IsNullOrEmpty(token)) { IOrganizationService orgService = MSCRM.GetOrgService(true, null, null); this.sda = new SqlDataAccess(); this.sda.openConnection(Globals.ConnectionString); MsCrmResult msCrmResult = MessageHelper.CreateMessage(message, orgService); if (msCrmResult.Success) { messageInfo = MessageHelper.GetMessageInfo(msCrmResult.CrmId, this.sda); } } } catch (Exception exception) { } } finally { if (this.sda != null) { this.sda.closeConnection(); } } return messageInfo; }
public Task ProcessPacket(LoginSession client, CPacket packet) { return(Process(client, (T)packet)); }
public MsCrmResult CreateUserGiftRequest(string token, string giftId) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion IOrganizationService service = MSCRM.GetOrgService(true); sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); MsCrmResultObject resultGetGiftInfo = GiftHelper.GetGiftInfo(new Guid(giftId), sda); MsCrmResultObject resultUserInfo = PortalUserHelper.GetPortalUserDetail(ls.PortalId, ls.PortalUserId, sda); int userPoint = ScoreHelper.GetUserScore(ls.PortalId, ls.PortalUserId, sda); if (resultGetGiftInfo.Success) { Gift gift = resultGetGiftInfo.GetReturnObject<Gift>(); PortalUser userInfo = resultUserInfo.GetReturnObject<PortalUser>(); TelephoneNumber telNo = ValidationHelper.CheckTelephoneNumber(userInfo.ContactInfo.MobilePhone); if (!telNo.isFormatOK) { returnValue.Success = false; returnValue.Result = "Cep telefonu bilginiz eksik veya formatı hatalıdır. Profilim bölümünden Cep telefpnu bilginizi güncelleyebilirsiniz."; return returnValue; } #region | POINT CONTROL | if (userPoint < gift.Point) { returnValue.Success = false; returnValue.Result = "Mevcut puanınız: " + userPoint.ToString() + ", hediye talebi için yeterli değildir."; return returnValue; } #endregion #region | ADDRESS CONTROL | if (userInfo.ContactInfo.CityId == null || userInfo.ContactInfo.TownId == null || string.IsNullOrEmpty(userInfo.ContactInfo.AddressDetail)) { returnValue.Success = false; returnValue.Result = "Adres bilgilerinizin tam olması gerekmektedir. Lütfen Profilim sayfasından Adres Bilgilerinizi güncelleyiniz"; return returnValue; } #endregion UserGiftRequest req = new UserGiftRequest(); req.Name = gift.Name + "-" + DateTime.Now.ToString("dd.MM.yyyy"); req.PortalId = new EntityReferenceWrapper() { Id = ls.PortalId, LogicalName = "new_portal" }; req.UserId = new EntityReferenceWrapper() { Id = ls.PortalUserId, LogicalName = "new_user" }; req.GiftId = new EntityReferenceWrapper() { Id = gift.Id, Name = gift.Name, LogicalName = "new_gift" }; req.Point = gift.Point; returnValue = GiftHelper.CreateUserGiftRequest(req, service); if (returnValue.Success) { Score sc = new Score() { Point = gift.Point * -1, Portal = req.PortalId.ToCrmEntityReference(), User = req.UserId.ToCrmEntityReference(), ScoreType = ScoreType.UsePoint }; MsCrmResult scoreRes = ScoreHelper.CreateScore(sc, service); } } else { returnValue.Result = resultGetGiftInfo.Result; } } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-CreateForumSubject"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public List <GuestAccount> GetActiveAccountsRequisitionedBy(LoginSession currentUser) { return(GetActiveGuestAccounts().Where(g => g.Description.Contains(currentUser.Username)).ToList()); }
public MsCrmResult DislikeEntity(string token, string entityId, string entityName) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = LikeHelper.IsUserLikedBefore(new Guid(entityId), entityName, ls.PortalUserId, sda); if (!returnValue.Success) { IOrganizationService service = MSCRM.GetOrgService(true); returnValue = LikeHelper.DislikeEntity(ls.PortalId, ls.PortalUserId, new Guid(entityId), entityName, service); } else { returnValue.Success = false; } } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-LikeEntity"; } } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public void LoginAttempt(string username, string password) { string publicKey = GetPublicKey (); if (publicKey != "") { Person person = new Person () { PublicKey = publicKey, Username = username, Password = password }; StringContent content = new StringContent (JsonConvert.SerializeObject (person)); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue ("application/json"); HttpResponseMessage response = _client.PostAsync ("Person/Login", content).Result; if (!response.IsSuccessStatusCode) { System.Web.HttpContext.Current.Response.Write ("<SCRIPT LANGUAGE=\"\"JavaScript\"\">alert(\"Login failed: " + response.StatusCode + ", make sure your login is correct and that your multichain node is the node associated with the account.\")</SCRIPT>"); } else { var stream = response.Content.ReadAsStringAsync ().Result; LoginSession session = JsonConvert.DeserializeObject<LoginSession> (stream); _loginToken = session; person.LoginSession = _loginToken; person.LoginSessionToken = _loginToken.Token; _thisPerson = person; HttpContext.Current.Session ["token"] = _loginToken; HttpContext.Current.Session ["person"] = _thisPerson; } } else { System.Web.HttpContext.Current.Response.Write ("<SCRIPT LANGUAGE=\"\"JavaScript\"\">alert(\"Could not contact multichain node, make sure its running.\")</SCRIPT>"); } }
public string GetAnnouncementList(string token, int start, int end) { MsCrmResultObject returnValue = new MsCrmResultObject(); LoginSession ls = new LoginSession(); JavaScriptSerializer ser = new JavaScriptSerializer(); string json = string.Empty; try { if (!string.IsNullOrEmpty(token)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { json = ser.Serialize(sessionResult); return json; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = AnnouncementHelper.GetAnnouncementList(ls.PortalId, ls.PortalUserId, start, end, sda); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-GetAnnouncementList"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-GetAnnouncementList"; } finally { if (sda != null) { sda.closeConnection(); } } json = ser.Serialize(returnValue); return json; }
internal async Task Login(AuthResult auth) { if (!Init.IsCompleted) { await Init; } if (auth.Content.Status != "LOGIN") { throw new ArgumentException("Invalid auth credentials"); } var context = Riot.Services.Service.RegisterObjects(); rtmp = new RtmpClient(new Uri("rtmps://" + Region.Current.MainServer + ":2099"), context, ObjectEncoding.Amf3); rtmp.MessageReceived += Rtmp_MessageReceived; rtmp.Disconnected += Rtmp_Disconnected; await rtmp.ConnectAsync(); chat.Connect(auth); LoginSession session = null; do { try { var creds = auth.GetAuthCredentials(); creds.ClientVersion = clientVersion; session = await LoginService.Login(creds); } catch (InvocationException x) when(x.RootCause is ClientVersionMismatchException) { var inner = (ClientVersionMismatchException)x.RootCause; clientVersion = (string)inner.SubstitutionArguments[1]; Log("Patch (DDragon outdated): " + clientVersion); } } while (session == null); string bc = $"bc-{session.AccountSummary.AccountId}"; string gn = $"gn-{session.AccountSummary.AccountId}"; string cn = $"cn-{session.AccountSummary.AccountId}"; await Task.WhenAll( rtmp.SubscribeAsync("my-rtmps", "messagingDestination", "bc", bc), rtmp.SubscribeAsync("my-rtmps", "messagingDestination", gn, gn), rtmp.SubscribeAsync("my-rtmps", "messagingDestination", cn, cn) ); await rtmp.LoginAsync(auth.Username.ToLower(), session.Token); string state = await AccountService.GetAccountState(); if (state != "ENABLED") { Log(state); throw new AuthenticationException("Not Enabled: " + state); } this.LoginQueue = auth.Content; this.loginSession = session; this.Me = await summoner.Connect(session); try { Authed?.Invoke(this, EventArgs.Empty); } catch (Exception x) { Log("Caught exception while dispatching auth: " + x); } BackEndServer.Async("/kappa/defer/auth", new JSONObject()); new Thread(HeartBeatLoop) { IsBackground = true }.Start(); }
public MsCrmResult CheckIsUserYourFriend(string token, string selectedUserId) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(selectedUserId)) { #region | CHECK SESSION | MsCrmResultObject sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return returnValue; } else { ls = (LoginSession)sessionResult.ReturnObject; } #endregion sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); returnValue = FriendshipHelper.CheckIsUserYourFriend(ls.PortalId, ls.PortalUserId, new Guid(selectedUserId), sda); } else { returnValue.Success = false; returnValue.Result = "M003"; //"Eksik parametre!-CheckIsUserYourFriend"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message + "-CheckIsUserYourFriend"; } finally { if (sda != null) { sda.closeConnection(); } } return returnValue; }
public ConfiguracoesController(LoginSession loginSession, IBackupDataBase bkp) { _loginSession = loginSession; _bkp = bkp; }
public void copy(LoginSession session, LoginSessionDto session_dto) { session.date_time = DateTime.Now; session.authentication_id = session_dto.authentication_id; session.type = session_dto.type; }
public Int32 GetEventsCount(LoginSession session, String server, Int32 list) { return(_adcSrv.GetEventsCount(server, list)); }
public override void Handle(LoginSession session, PacketReader packet) { session.ServerTick = packet.ReadInt(); session.ClientTick = packet.ReadInt(); }
public TypeOfList GetListType(LoginSession session, String server, Int32 list) { var result = _adcSrv.GetListType(server, list); return(result); }
public TestMutation(IHttpContextAccessor httpContext) { FieldAsync <ResponseType <GroupType> >("addAnimal", arguments: new QueryArguments(new QueryArgument <GroupInput> { Name = "animal" }), resolve: async context => { Group animal = context.GetArgument <Group>("animal"); await BaseProcs.Add(animal); return(Success(animal)); } ); FieldAsync <ResponseType <GroupType> >("updateAnimal", description: "Cập nhật animal yêu cầu quyền của người đã login", arguments: new QueryArguments(new QueryArgument <GroupInput> { Name = "animal" }), resolve: async context => { var user = LoginSession.Current(httpContext.HttpContext); Group animal = context.GetArgument <Group>("animal"); await BaseProcs.Update(animal); return(Success(animal, $"bạn đã update thành công bằng tài khoản {user.UserName}")); } ).FieldAuthorizeWithName(Policies.BASE_ACCOUNT_POLICY); FieldAsync <ResponseType <LoginSessionType> >("login", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "username" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "password" }), resolve: async context => { string username = context.GetArgument <string>("username"); string password = context.GetArgument <string>("password"); ///giả thiết check database thành công thì lưu vào session để các query sau hiểu là thằng này đã đăng nhập ///module Authentication sẽ tự động check header Authorization của client gửi lên và truy vấn các cache này để quyết định ///1 user có đang login hay không /// RedisConnection cache = new RedisConnection(); LoginSession session = new LoginSession() { FullName = "Register to input this field", AccessToken = Guid.NewGuid().ToString("N"), CreateOn = DateTime.Now, ExpireOn = DateTime.Now.AddHours(2), UserName = username, }; //lưu session=redis (cache = database) await cache.StoreAsync(session, TimeSpan.FromDays(2)); //for test i will let the time long var HttpContext = httpContext.HttpContext; //cache bằng session mặc định của dotnet HttpContext.Session.SetString("token", JsonConvert.SerializeObject(session)); return(Success(session)); } ); }
public int GetLookahead(LoginSession session, String server, Int32 list) { int result = _adcSrv.GetLookAhead(server, list); return(result); }
public IActionResult removeTFA([FromBody] string tfaCode, [FromHeader] string token) { // Check if the user managed to login with user and password but don't check 2fa here if (Logins.Verify(token, false, false) != null) { // Check if the user has 2fa enabled List <LoginSession> v = Program.db.Query <LoginSession>($"SELECT * FROM LoginSession WHERE id = '{token}';"); LoginSession u = v.Count > 0 ? v.First() : null; // Get the user that owns this session List <User> users = Program.db.Query <User>($"SELECT * FROM User WHERE id='{u.userId}';"); User user = users.Last(); if (!u.passed2FA) { return(BadRequest("2FA must be validated before we can disable 2FA on this account.")); } if (users.Count > 0) { if (!string.IsNullOrEmpty(user.twoFactorSecret)) { var tfa = new TwoFactorAuth("Cashier API"); //TODO: Change org to company name from global settings (WIP) // Verify if 2FA code is valid if (tfa.VerifyCode(user.twoFactorSecret, tfaCode)) { // If 2FA was never confirmed let's make it confirmed as we validated a code. if (user.twoFactorConfirmed) { user.twoFactorConfirmed = false; user.twoFactorSecret = ""; Program.db.Update(user); } else { return(BadRequest("2FA was not enabled on this account, therefore we cannot disable it either.")); } return(Ok(u)); } else { return(Unauthorized("Incorrect 2FA code")); } } else { return(BadRequest("2FA is not enabled for this account.")); } } else { return(BadRequest("No user found with this login token.")); } } else { return(Unauthorized()); } }
public EventProblemInformationDTO GetGapProblemInformation(LoginSession session, String server, int list) { var tmpList = _adcSrv.GetEventsList(server, list).ToList(); Boolean isGap = false; Boolean isMissing = false; // hardstart var gapProblemEvent = new EventProblemInformationDTO(); var index = tmpList.FindIndex(pair => pair.IsHardStart && !pair.ADCEvent.EventStatus.Contains(EventRunStatus.Done)); if (index > 0) { var hardStartEvent = tmpList[index].ToDTO();// _dataServiceManager.AddDataBaseFields(tmpList[index].ToDTO()); index--; for (; index > -1; index--) { // this is last event before hardstart if (tmpList[index].IsPrimary) { break; } } // primary event index if (index > 0) { var endEvent = tmpList[index].ToDTO();// _dataServiceManager.AddDataBaseFields(tmpList[index].ToDTO()); var startTimeGap = (endEvent.OnAirTime.ToTimeCode() + endEvent.Duration.ToTimeCode()); var gapTimeInterval = hardStartEvent.OnAirTime.ToTimeCode() - startTimeGap; gapProblemEvent.Duration = new TimeCodeDTO(gapTimeInterval); gapProblemEvent.InsertId = endEvent.AdcEventId; gapProblemEvent.StartTime = new TimeCodeDTO(startTimeGap); gapProblemEvent.DeleteId = Guid.Empty; gapProblemEvent.IdDeletedEvent = hardStartEvent.ID; isGap = true; } } //missing media var missingProblemEvent = new EventProblemInformationDTO(); index = tmpList.FindIndex(pair => pair.IsMissing); if (index > 0) { var missingMedia = tmpList[index].ToDTO();// _dataServiceManager.AddDataBaseFields(tmpList[index].ToDTO()); index--; for (; index > -1; index--) { // this is last event before hardstart if (tmpList[index].IsPrimary) { break; } } // primary event index if (index > 0) { var endEvent = tmpList[index].ToDTO();// _dataServiceManager.AddDataBaseFields(tmpList[index].ToDTO()); var startTimeMissing = (endEvent.OnAirTime.ToTimeCode() + endEvent.Duration.ToTimeCode()); missingProblemEvent.Duration = missingMedia.Duration; missingProblemEvent.DeleteId = missingMedia.AdcEventId; missingProblemEvent.InsertId = endEvent.AdcEventId; missingProblemEvent.StartTime = new TimeCodeDTO(startTimeMissing); missingProblemEvent.IdDeletedEvent = missingMedia.ID; if (isGap) { if (missingProblemEvent.StartTime.ToTimeCode() > gapProblemEvent.StartTime.ToTimeCode()) { return(gapProblemEvent); } return(missingProblemEvent); } isMissing = true; } } if (isGap) { return(gapProblemEvent); } if (isMissing) { return(missingProblemEvent); } return(null); }
public MsCrmResult CreateAsseblyRequest(string token, AssemblyRequestInfo requestInfo) { MsCrmResult returnValue = new MsCrmResult(); LoginSession ls = new LoginSession(); try { #region | CHECK SESSION | MsCrmResultObj <LoginSession> sessionResult = GetUserSession(token); if (!sessionResult.Success) { returnValue.Result = sessionResult.Result; return(returnValue); } else { ls = sessionResult.ReturnObject; } #endregion _service = MSCRM.GetOrgService(true); //_sda = new SqlDataAccess(); //_sda.openConnection(Globals.ConnectionString); #region | DATA VALIDATION | if (string.IsNullOrWhiteSpace(requestInfo.FirstName)) { returnValue.Result = "Ad alanı boş olamaz."; return(returnValue); } if (string.IsNullOrWhiteSpace(requestInfo.LastName)) { returnValue.Result = "Soyad alanı boş olamaz."; return(returnValue); } if (string.IsNullOrWhiteSpace(requestInfo.MobilePhoneNumber)) { returnValue.Result = "Cep Telefonu alanı boş olamaz."; return(returnValue); } if (!ValidationHelper.CheckTelephoneNumber(requestInfo.MobilePhoneNumber).isFormatOK) { returnValue.Result = "Cep Telefonu formatı hatalıdır. Örn:+90-5xx-xxxxxxx şeklinde olmalıdır."; return(returnValue); } if (string.IsNullOrWhiteSpace(requestInfo.EmailAddress)) { returnValue.Result = "Email adresi alanı boş olamaz."; return(returnValue); } if (string.IsNullOrWhiteSpace(requestInfo.AddressDetail)) { returnValue.Result = "Adres detayı alanı boş olamaz."; return(returnValue); } if (requestInfo.RequestCityId == null || requestInfo.RequestCityId == Guid.Empty) { returnValue.Result = "İl alanı boş olamaz."; return(returnValue); } if (requestInfo.RequestTownId == null || requestInfo.RequestTownId == Guid.Empty) { returnValue.Result = "İlçe alanı boş olamaz."; return(returnValue); } #endregion requestInfo.Name = requestInfo.Name + "|" + requestInfo.LastName + "|" + DateTime.Now.ToString("dd.MM.yyyy HH:mm"); returnValue = AssemblyRequestHelper.CreateAssemblyRequest(requestInfo, _service); } catch (Exception ex) { returnValue.HasException = true; returnValue.Result = ex.Message; } finally { if (_sda != null) { _sda.closeConnection(); } } return(returnValue); }
public void DeleteAllEvents(LoginSession session, String server, Int32 list) { CheckListLock(server, list); _adcSrv.DeleteAllEvents(server, list); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (LoginSession.IsLogin()) { if (!LoginSession.IsAdmin()) { if (!LoginSession.IsView("MN-00002")) { Response.Redirect("NoPermitsion.aspx"); } } } else { Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery); } hidUserName.Value = LoginSession.UserName(); #region CategorysMN aCategorysMN = new CategorysMN(); ListItem aListItem = new ListItem(); string CatTypeCode = string.Empty; CatTypeCode = "CT-00003"; //Application Site ddlApplicationSite.Items.Clear(); ddlApplicationSite.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); ddlApplicationSite.DataValueField = "CatCode"; ddlApplicationSite.DataTextField = "CatName"; ddlApplicationSite.DataBind(); //CatTypeCode = "CT-00004"; //Doc Type //ddlDocType.Items.Clear(); //ddlDocType.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); //ddlDocType.DataValueField = "CatCode"; //ddlDocType.DataTextField = "CatName"; //ddlDocType.DataBind(); CatTypeCode = "CT-00002"; ddlPreservingDepartment.Items.Clear(); ddlPreservingDepartment.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); ddlPreservingDepartment.DataValueField = "CatCode"; ddlPreservingDepartment.DataTextField = "CatName"; ddlPreservingDepartment.DataBind(); ddlPreservingDepartment.Items.Insert(0, new ListItem("---ALL---", "ALL")); CatTypeCode = "CT-00009"; ddlStorageTime.Items.Clear(); ddlStorageTime.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); ddlStorageTime.DataValueField = "CatCode"; ddlStorageTime.DataTextField = "CatName"; ddlStorageTime.DataBind(); UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN(); #endregion #region string DocNo = Convert.ToString(Request.QueryString["DocNo"]); string CodeDocument = Convert.ToString(Request.QueryString["CodeDocument"]); string PublishDocument = Convert.ToString(Request.QueryString["PublishDocument"]); if (!String.IsNullOrEmpty(CodeDocument) && !String.IsNullOrEmpty(DocNo)) { #region ddlDepartment.Items.Clear(); ddlDepartment.DataSource = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName()); ddlDepartment.DataValueField = "Department"; ddlDepartment.DataTextField = "NameDepartment"; ddlDepartment.DataBind(); hidCodeDocument.Value = CodeDocument; RegisterCodeDocumentMN aRegisterCodeDocumentMN = new RegisterCodeDocumentMN(); txtApplicationName.Text = LoginSession.FullName(); txtApplicationNO.Text = string.Empty; txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); DataTable aData = aRegisterCodeDocumentMN.ListRegisterCodeDocumentByDCC(CodeDocument, string.Empty, DocNo, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01")); if (aData.Rows.Count > 0) { txtDocNO.Text = Convert.ToString(aData.Rows[0]["DocNo"]); txtDocName.Text = Convert.ToString(aData.Rows[0]["DocName"]); ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]); //hidFileName.Value = Convert.ToString(aData.Rows[0]["FileName"]); //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]); hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]); //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]); } #endregion } else { if (!String.IsNullOrEmpty(PublishDocument)) { #region RegisterPublishDocumentMN aRegisterPublishDocumentMN = new RegisterPublishDocumentMN(); DataTable aData = aRegisterPublishDocumentMN.ListRegisterPublishDocument(PublishDocument, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01")); if (aData.Rows.Count > 0) { ddlDepartment.Items.Clear(); ddlDepartment.DataSource = aUserInDepartmentMN.ListDepartmentByUserName(Convert.ToString(aData.Rows[0]["CreatedBy"])); ddlDepartment.DataValueField = "Department"; ddlDepartment.DataTextField = "NameDepartment"; ddlDepartment.DataBind(); txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]); hidID.Value = Convert.ToString(aData.Rows[0]["ID"]); hidPublishDocument.Value = PublishDocument; hidStates.Value = Convert.ToString(aData.Rows[0]["States"]); txtApplicationNO.Text = Convert.ToString(aData.Rows[0]["PublishDocument"]); ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]); txtEffectiveDate.Text = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty; txtDocNO.Text = Convert.ToString(aData.Rows[0]["DocumentNo"]); txtREV.Text = Convert.ToString(aData.Rows[0]["Rev"]); txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]); //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]); //txtRevisionApplication.Text = Convert.ToString(aData.Rows[0]["RevisionApplication"]); //txtCheckingNotice.Text = Convert.ToString(aData.Rows[0]["CheckingNotice"]); txtDocumentObsolete.Text = Convert.ToString(aData.Rows[0]["DeletedDocumentOld"]); txtDocumentReference.Text = Convert.ToString(aData.Rows[0]["ReferenceDocument"]); //txtWordKey.Text = Convert.ToString(aData.Rows[0]["IndexWord"]); txtApplicationDate.Text = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss"); hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]); //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]); //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]); hidFileName.Value = Convert.ToString(aData.Rows[0]["ContentFile"]); hidNeedRelease.Value = Convert.ToString(aData.Rows[0]["NeedReleaseFile"]); aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"])); if (aListItem != null) { ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]); } } #endregion } } #endregion } }
public void GangTensionRelease(LoginSession session, String server, IEnumerable <Int32> lists) { _adcSrv.GangTensionRelease(server, lists); }
public ActionResult Index(LoginModel model, string returnUrl) { ViewBag.Message = "Energy Billing System"; ViewBag.ReturnUrl = returnUrl; if (ModelState.IsValid) { if (System.Web.Security.Membership.ValidateUser(model.UserName.Trim(), model.Password.Trim())) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { String MemberID = System.Web.Security.Membership.GetUser(model.UserName.ToUpper()).ProviderUserKey.ToString(); LoginSession loginSession = new LoginSession(); loginSession = BAL.BALLoginSessionModels.LoginDetails(model.UserName); Session["Login"] = loginSession; if (loginSession.UserType == "Consumer") { UserConsumerDetails Consumer = null; Consumer = BAL.SearchModel.UserConsumer(loginSession.UserID.ToString()); if (Consumer != null) { return RedirectToAction("ConsumerDetails", "Search", new { consID = BAL.Security.URLEncrypt(Consumer.ConsumerID.ToString()), OwnerID = BAL.Security.URLEncrypt(Consumer.OwnerID.ToString()), PropID = BAL.Security.URLEncrypt(Consumer.PropertyID.ToString()), SiteID = BAL.Security.URLEncrypt(Convert.ToString(Consumer.SiteID)), ClientID = BAL.Security.URLEncrypt(Convert.ToString(Consumer.ClientID)), MeterID = BAL.Security.URLEncrypt(Convert.ToString(Consumer.MeterID)) }); } else { FormsAuthentication.SignOut(); Session["USER"] = ""; Session.Abandon(); return RedirectToAction("Index", "Home"); } } else { return RedirectToAction("Dashboard", "Home"); } } } else { ModelState.AddModelError("", ""); } } else { return RedirectToAction("Index", "Home"); } return View(); }
public MsCrmResult SetUserSession(string token, Guid portalId, Guid portalUserId) { MsCrmResult returnValue = new MsCrmResult(); try { LoginSession ls = new LoginSession() { Token = token, PortalId = portalId, PortalUserId = portalUserId }; HttpContext.Current.Cache.Add(token, ls, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null); returnValue.Success = true; returnValue.Result = "Oturum bilgileri işlendi"; } catch (Exception ex) { returnValue.Result = ex.Message; } return returnValue; }
public static void HandleCreate(LoginSession session, PacketReader packet) { byte gender = packet.ReadByte(); Job job = (Job)packet.ReadShort(); string name = packet.ReadUnicodeString(); SkinColor skinColor = packet.Read <SkinColor>(); packet.Skip(2); if (DatabaseManager.Characters.NameExists(name)) { session.Send(ResponseCharCreatePacket.NameTaken()); return; } Account account = DatabaseManager.Accounts.FindById(session.AccountId); Player newCharacter = new Player(account, name, gender, job, skinColor); session.CharacterId = newCharacter.CharacterId; byte equipCount = packet.ReadByte(); for (int i = 0; i < equipCount; i++) { int id = packet.ReadInt(); string typeStr = packet.ReadUnicodeString(); if (!Enum.TryParse(typeStr, out ItemSlot type)) { throw new ArgumentException($"Unknown equip type: {typeStr}"); } EquipColor equipColor = packet.Read <EquipColor>(); switch (type) { case ItemSlot.HR: // Hair // Hair Length/Position float backLength = packet.ReadFloat(); CoordF backPositionCoord = packet.Read <CoordF>(); CoordF backPositionRotation = packet.Read <CoordF>(); float frontLength = packet.ReadFloat(); CoordF frontPositionCoord = packet.Read <CoordF>(); CoordF frontPositionRotation = packet.Read <CoordF>(); if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.HR, new Item(id) { Color = equipColor, HairData = new HairData(backLength, frontLength, backPositionCoord, backPositionRotation, frontPositionCoord, frontPositionRotation), IsTemplate = false, IsEquipped = true }); break; case ItemSlot.FA: // Face if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.FA, new Item(id) { Color = equipColor, IsTemplate = false, IsEquipped = true }); break; case ItemSlot.FD: // Face Decoration byte[] faceDecoration = packet.Read(16); // Face decoration position if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.FD, new Item(id) { Color = equipColor, FaceDecorationData = faceDecoration, IsTemplate = false, IsEquipped = true }); break; case ItemSlot.CL: // Clothes if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.CL, new Item(id) { Color = equipColor, IsTemplate = false, IsEquipped = true }); break; case ItemSlot.PA: // Pants if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.PA, new Item(id) { Color = equipColor, IsTemplate = false, IsEquipped = true }); break; case ItemSlot.SH: // Shoes if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.SH, new Item(id) { Color = equipColor, IsTemplate = false, IsEquipped = true }); break; case ItemSlot.ER: // Ear if (!DefaultItemsMetadataStorage.IsValid((int)job, id)) { continue; } newCharacter.Inventory.Cosmetics.Add(ItemSlot.ER, new Item(id) { Color = equipColor, IsTemplate = false, IsEquipped = true }); break; } } packet.ReadInt(); // const? (4) DatabaseManager.Inventories.Update(newCharacter.Inventory); // Send updated CHAR_MAX_COUNT session.Send(CharacterListPacket.SetMax(account.CharacterSlots)); // Send CHARACTER_LIST for new character only (append) session.Send(CharacterListPacket.AppendEntry(newCharacter)); }
private void OnSetSession(byte[] body) { uint session = 0; session = ++NextSession; if (session >= 0x40000000) { NextSession = 1; session = 1; } if (session > 0) { LoginSession logonsession = new LoginSession(); logonsession.client = this; LoginSessionHandler.sessions.Add(session, logonsession); SMSG_SETSESSION spkt = new SMSG_SETSESSION(); spkt.SessionId = session; this.Send((byte[])spkt); } else { Trace.TraceError("No session found"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (LoginSession.IsLogin()) { if (!LoginSession.IsAdmin()) { if (!LoginSession.IsView("MN-00016")) { Response.Redirect("NoPermitsion.aspx"); } } } else { Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery); } hidUserName.Value = LoginSession.UserName(); #region UsersMN aUsersMN = new UsersMN(); CategorysMN aCategorysMN = new CategorysMN(); ListItem aListItem = new ListItem(); string CatTypeCode = string.Empty; CatTypeCode = "CT-00003"; //Application Site ddlApplicationSite.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); ddlApplicationSite.DataValueField = "CatCode"; ddlApplicationSite.DataTextField = "CatName"; ddlApplicationSite.DataBind(); //CatTypeCode = "CT-00004"; //Doc Type //ddlDocType.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode); //ddlDocType.DataValueField = "CatCode"; //ddlDocType.DataTextField = "CatName"; //ddlDocType.DataBind(); #endregion #region string PublishDocument = Convert.ToString(Request.QueryString["PublishDocument"]); string ObsoletedDocument = Convert.ToString(Request.QueryString["ObsoletedDocument"]); if (!String.IsNullOrEmpty(PublishDocument)) { #region RegisterPublishDocumentMN aRegisterPublishDocumentMN = new RegisterPublishDocumentMN(); txtApplicationName.Text = LoginSession.FullName(); txtApplicationNO.Text = string.Empty; txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); hidPublishDocument.Value = PublishDocument; DataTable aData = aRegisterPublishDocumentMN.ListRegisterPublishDocument(PublishDocument, string.Empty, "C26", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01")); if (aData.Rows.Count > 0) { ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]); //hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]); txtDocNO.Text = Convert.ToString(aData.Rows[0]["DocumentNo"]); txtREV.Text = Convert.ToString(aData.Rows[0]["Rev"]); txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]); txtReleaseDate.Text = Convert.ToString(aData.Rows[0]["EffectiveDate_Text"]); //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]); //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]); //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]); DataTable aTemp = new DataTable(); aTemp = aCategorysMN.ListCategorys(Convert.ToString(aData.Rows[0]["Department"]), string.Empty, string.Empty); txtApplicationDep.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty; txtDepartment.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty; aTemp = aUsersMN.GetManagerCurrent(); txtManager.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["HoTen"]) : string.Empty; } #endregion } else { if (!String.IsNullOrEmpty(ObsoletedDocument)) { #region ApplicationObsoletedDocumentMN aApplicationObsoletedDocumentMN = new ApplicationObsoletedDocumentMN(); DataTable aData = aApplicationObsoletedDocumentMN.ListApplicationObsoletedDocument(ObsoletedDocument, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01")); if (aData.Rows.Count > 0) { txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]); hidID.Value = Convert.ToString(aData.Rows[0]["ID"]); hidObsoletedDocument.Value = ObsoletedDocument; hidStates.Value = Convert.ToString(aData.Rows[0]["States"]); txtApplicationNO.Text = Convert.ToString(aData.Rows[0]["ObsoletedDocument"]); hidPublishDocument.Value = Convert.ToString(aData.Rows[0]["PublishDocument"]); txtEffectiveDate.Text = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty; txtApplicationDate.Text = Convert.ToString(aData.Rows[0]["ApplicationDate_Text"]); ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]); //hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]); txtDocNO.Text = Convert.ToString(aData.Rows[0]["DocumentNo"]); txtREV.Text = Convert.ToString(aData.Rows[0]["Rev"]); txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]); txtReleaseDate.Text = Convert.ToString(aData.Rows[0]["EffectiveDate_Text"]); //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]); //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]); //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]); DataTable aTemp = new DataTable(); aTemp = aCategorysMN.ListCategorys(Convert.ToString(aData.Rows[0]["Department"]), string.Empty, string.Empty); txtApplicationDep.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty; txtDepartment.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty; aTemp = aUsersMN.GetManagerCurrent(); txtManager.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["HoTen"]) : string.Empty; txtReasonObsoleted.Text = Convert.ToString(aData.Rows[0]["ReasonObsoleted"]); } #endregion } } #endregion } }