public async Task <List <FileDoc> > FindAllForUserAsync(string userId, bool delete = false) { var listOfFileDocs = (FindAll(delete) as IQueryable <FileDoc>); Person person = PersonBiz.GetPersonForUserId(userId); person.IsNullThrowException("person not found!"); string personId = person.Id; listOfFileDocs = listOfFileDocs.Where(x => x.PersonId == personId); return(await listOfFileDocs.ToListAsync()); }
public ListOfPersons SearchPerson(string name) { PersonBiz personBiz = new PersonBiz(); AgeRanger.Data.AgeRangerDataFactory ageRangerDataFactory = new Data.AgeRangerDataFactory(); ISqlFactory sqlFactory = ageRangerDataFactory.GetReposotory(); PersonModel person = new PersonModel(); person.FirstName = name; person.LastName = name; return(personBiz.SearchForPerson(person, sqlFactory)); }
public ActionResult DeletePhoto(Guid id) { PersonBiz biz = new PersonBiz(); PhotoInfo photoInfo = biz.GetPhoto(id); if (biz.DeletePhoto(id)) { PersonInfo person = biz.Find(photoInfo.PersonID); return(RedirectToAction("View", person)); } return(View()); }
private void InitDataPage1() { ReportDocument rpt = new ReportDocument(); PersonBiz biz = new PersonBiz(); var res = biz.GetById(this.UserProfile.Id); var ls = new List <PersonLicenseAgreement>(); if ((!res.IsError) && (res.DataResponse != null)) { PersonLicenseAgreement ent = new PersonLicenseAgreement(); ent.SEX = res.DataResponse.SEX; ent.NAMES = res.DataResponse.NAMES; ent.LASTNAME = res.DataResponse.LASTNAME; ent.MEMBER_TYPE = res.DataResponse.MEMBER_TYPE; ls.Add(ent); } if (this.Menu.Equals((int)DTO.MenuLicenses.Step1)) { rpt.Load(Server.MapPath("../Reports/" + "RptAgreement_1.rpt")); rpt.SetDataSource(ls); //;rpt.SetDataSource(new[] { ls }); //rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath(this.ArgPath + this.ArgOutPutFile)); BindReport(rpt); //resArg.ResultMessage = true; } else if (this.Menu.Equals((int)DTO.MenuLicenses.Step2)) { rpt.Load(Server.MapPath("../Reports/" + "RptAgreement_2.rpt")); rpt.SetDataSource(ls); //;rpt.SetDataSource(new[] { ls }); //rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath(this.ArgPath + this.ArgOutPutFile)); BindReport(rpt); //resArg.ResultMessage = true; } else if (this.Menu.Equals((int)DTO.MenuLicenses.Step3)) { rpt.Load(Server.MapPath("../Reports/" + "RptAgreement_3.rpt")); rpt.SetDataSource(ls); //;rpt.SetDataSource(new[] { ls }); //rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath(this.ArgPath + this.ArgOutPutFile)); BindReport(rpt); //resArg.ResultMessage = true; } }
protected void DeleteButton_Click(object sender, EventArgs e) { try { PersonBiz pBiz = new PersonBiz(); pBiz.DeletePerson(this.ComposerId); Response.Redirect("Composers.aspx"); } catch (Exception exc) { ProcessException(exc); } }
public List <FileDoc> FindAllForUser(string userId, bool delete = false) { userId.IsNullOrWhiteSpaceThrowArgumentException("userId"); Person person = PersonBiz.GetPersonForUserId(userId); person.IsNullThrowException("person not found!"); string personId = person.Id; var listOfFileDocs = FindAll(delete) as IQueryable <FileDoc>; listOfFileDocs = listOfFileDocs.Where(x => x.PersonId == personId); return(listOfFileDocs.ToList()); }
protected void btnRemoveImage_Click(object sender, EventArgs e) { lwg_Person person = null; PersonBiz pbiz = new PersonBiz(); person = pbiz.GetByID(this.ComposerId); if (person != null) { PictureManager.DeletePicture(person.PictureID.Value); person.PictureID = 0; pbiz.SavePerson(person); btnRemoveImage.Visible = false; BindData(); } }
public void IsEmailAvailable() { PersonBiz biz = new PersonBiz(new WindowsStoreContext()); var res = biz.Where(null); var service = new DeveloperService(); var userManagementDomainService = new UserManagementDomainService(); // var result = service.IsEmailAvailableForRegistration("*****@*****.**"); service.ResendActivationCode("*****@*****.**"); bool result = service.TryActivateAccount("*****@*****.**", 5999); var r = service.GetAppCategories(); }
private void createMessageFor(string fromPersonId, string toPersonId, string subject, string body) { fromPersonId.IsNullOrWhiteSpaceThrowArgumentException(); toPersonId.IsNullOrWhiteSpaceThrowArgumentException(); subject.IsNullOrWhiteSpaceThrowArgumentException(); body.IsNullOrWhiteSpaceThrowArgumentException(); Person fromPerson = PersonBiz.Find(fromPersonId); fromPerson.IsNullThrowException(); Message message = new Message(fromPersonId, fromPerson, toPersonId, subject, body, MessageENUM.Free, null); MessageBiz.Create(message); }
protected void ListcomposersByFirstLetter(string FirstLetter) { try { PersonBiz pb = new PersonBiz(); List <lwg_Person> persons = pb.GetPersonByFirstLetter(FirstLetter); this.Literal4.Text = this.CreateHtml(persons, FirstLetter); } catch (Exception ex) { Response.Write(ex.Message); } }
public void UpdateAndSaveDefaultAddress(string userId, string addressId, GlobalObject globalObject) { userId.IsNullOrWhiteSpaceThrowArgumentException("userId"); addressId.IsNullOrWhiteSpaceThrowArgumentException("AddressId is null"); AddressMain address = Find(addressId); address.IsNullThrowException("Address"); //the default address must always be all three if (!address.AddressType.IsBillAddress || !address.AddressType.IsShipAddress || !address.AddressType.IsInformAddress) { if (!address.AddressType.IsBillAddress) { ErrorsGlobal.AddMessage("Updated to Billing address."); } if (!address.AddressType.IsShipAddress) { ErrorsGlobal.AddMessage("Updated to Shipping address."); } if (!address.AddressType.IsInformAddress) { ErrorsGlobal.AddMessage("Updated to Inform To address."); } address.AddressType.IsBillAddress = true; address.AddressType.IsShipAddress = true; address.AddressType.IsInformAddress = true; Update(address); } Person person = UserBiz.GetPersonFor(userId); person.IsNullThrowException("Person not found"); person.DefaultBillAddressId = addressId; ControllerCreateEditParameter param = new ControllerCreateEditParameter(); param.Entity = person as ICommonWithId; param.GlobalObject = globalObject; PersonBiz.UpdateAndSave(param); //PersonBiz.UpdateAndSave(person); }
protected void btnPwdCancel_Click(object sender, EventArgs e) { PersonBiz biz = new PersonBiz(); var curUserName = HttpContext.Current.Session["currentusername"]; if (curUserName != null) { ResponseMessage <bool> res = biz.SetOffLineStatus(curUserName.ToString()); if (res.ResultMessage == true) { Session["currentusername"] = null; } } Session.Abandon(); }
/// <summary> /// This automatically creates a person if one does not exist. /// </summary> /// <param name="userId"></param> /// <returns></returns> public Person GetPersonForUserId(string userId) { userId.IsNullOrWhiteSpaceThrowException("User not logged in."); //find the person Person userPerson = UserBiz.GetPersonFor(userId); ApplicationUser user = GetUser(userId); user.IsNullThrowException(); if (userPerson.IsNull()) { //the userPerson is coming back as null. This can also happen if the user //and the person have become disconnected due to user being deleted. //so check to see if the person exists. If the person exists then attach him to the //user. Person personWithAdminName = PersonBiz.FindByName(user.UserName); //create a person if one does not exist. if (personWithAdminName.IsNull()) { //create person user.IsNullThrowException(); userPerson = PersonBiz.Factory() as Person; userPerson.Name = user.Name; if (userPerson.Users.IsNull()) { userPerson.Users = new List <ApplicationUser>(); } userPerson.Users.Add(user); PersonBiz.Create(userPerson); } else { personWithAdminName.Users.Add(user); PersonBiz.Update(personWithAdminName); } SaveChanges(); } return(userPerson); }
protected void BindData() { string PId = Request.QueryString["ComposerID"].ToString(); PersonBiz personBiz = new PersonBiz(); Int32 personID; if (Int32.TryParse(PId, out personID)) { var productCollection = personBiz.GetAllProductWithComposerId(personID); dlViewTitle.DataSource = productCollection; dlViewTitle.DataBind(); } else { Response.Redirect("~/MeetComposers.aspx"); } }
private void BindReport() { LicenseBiz biz = new LicenseBiz(); PersonBiz perBiz = new PersonBiz(); ReportDocument rpt = new ReportDocument(); CrystalReport1 cr = new CrystalReport1(); var res = perBiz.GetById(id); string ReportFolder = @"D:\[-- AR Soft --]\[-- Project --]\IAS_PROJECT10\Web\IAS\Reports\"; //rpt.Load(Server.MapPath(ReportFolder + "RptAgreement_1.rpt")); //rpt.SetDataSource(res.DataResponse); cr.Load(ReportFolder + "RptAgreement_1.rpt"); cr.SetDataSource(new [] { res }); CrystalReportViewer.ReportSource = cr; }
protected void hpLogout_Click(object sender, EventArgs e) { PersonBiz biz = new PersonBiz(); var curUserName = HttpContext.Current.Session["currentusername"]; if (curUserName != null) { ResponseMessage <bool> res = biz.SetOffLineStatus(curUserName.ToString()); if (res.ResultMessage == true) { Session["currentusername"] = null; } } Session.Abandon(); //Session.Clear(); Response.Redirect("~/home.aspx"); }
protected void dtlTopComposer_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { lwg_Person obj = (lwg_Person)e.Item.DataItem; if (obj != null) { Label lblNumber = (Label)e.Item.FindControl("lblNumber"); lblNumber.Text = (e.Item.ItemIndex + 1).ToString(); HyperLink lblName = (HyperLink)e.Item.FindControl("lblName"); lblName.Text = obj.NameDisplay; lblName.NavigateUrl = string.Format("~/ComposerDetails.aspx?ComposerID={0}", obj.PersonId); PersonBiz pBiz = new PersonBiz(); Label lblProductNumber = (Label)e.Item.FindControl("lblProductNumber"); lblProductNumber.Text = pBiz.CountTotalProductWithComposerRole(obj.PersonId).ToString(); } } }
public PersonServedBySalesmanWithTotalTrxAmountAdded_Header CreateSalesmanReport_PeopleServedBySalesman(string userId) { userId.IsNullOrWhiteSpaceThrowException("Not logged in"); int noOfDaysSalesmanKeepsPerson = GetNoOfDaysSalesmanKeepsPerson(); int minimumAmountOfSaleRequired = GetMinimumRuppeeAmountRequiredToKeepPerson(); DateTime beginDate = DateTime.Now.AddDays(-1 * noOfDaysSalesmanKeepsPerson); DateTime endDate = DateTime.Now; Person salesmanPerson = PersonBiz.GetPersonForUserId(userId); salesmanPerson.IsNullThrowException("Salesman not found."); PersonServedBySalesmanWithTotalTrxAmountAdded_Header header = new PersonServedBySalesmanWithTotalTrxAmountAdded_Header(userId, salesmanPerson, beginDate, endDate, minimumAmountOfSaleRequired); header.Detail = ListPeopleBoughtOrSoldCashFromSalesman(header); return(header); }
protected void btnLogin_Click(object sender, EventArgs e) { //ตรวยสอบ Key APP_FOR_OIC ใน Web.config ถ้าไม่มีให้ Default = No string appForOIC = System.Configuration.ConfigurationManager.AppSettings["APP_FOR_OIC"] == null ? "No" : System.Configuration.ConfigurationManager.AppSettings["APP_FOR_OIC"].ToUpper(); string toPage = UserAuthen(appForOIC); if (toPage != "home.aspx") { var memberType = (DTO.MemberType)((DTO.UserProfile)Session[PageList.UserProfile]).MemberType; if (memberType == DTO.MemberType.Insurance || memberType == DTO.MemberType.Association || memberType == DTO.MemberType.TestCenter) { gotoPage = toPage; CheckChangePassword(); } else { Response.Redirect(toPage); } } else { //biz.UserAuthen(txtUserName.Text, txtPassword.Text); PersonBiz biz = new PersonBiz(); //ใช้จริง DTO.ResponseService <DTO.UserProfile> res = biz.UserAuthen(txtUserName.Text.Trim(), txtPassword.Text, (appForOIC == "YES"), GetIPAddress()); if (res.IsError) { AlertMessage.ShowAlertMessage(string.Empty, res.ErrorMsg); } else { AlertMessage.ShowAlertMessage(string.Empty, Resources.infohome_001); } } }
private long GetNextFileNumber() { UserId.IsNullOrWhiteSpaceThrowException("UserId"); Person person = PersonBiz.GetPersonForUserId(UserId); person.IsNullThrowException("person"); string personId = person.Id; var fileDocs = FindAll().Where(x => x.PersonId == personId).ToList(); long nextFileNumber = 0; if (fileDocs.IsNullOrEmpty()) { nextFileNumber = 1; } else { nextFileNumber = fileDocs.Max(x => x.FileNumber) + 1; } return(nextFileNumber); }
private void add_Name(Salesman salesman) { if (salesman.Name.IsNullOrWhiteSpace()) { if (salesman.Person.IsNull()) { if (salesman.PersonId.IsNullOrWhiteSpace()) { throw new Exception("No person added."); } else { Person person = PersonBiz.Find(salesman.PersonId); salesman.Name = person.Name; } } else { salesman.Name = salesman.Person.Name; } } }
protected void btnAuthByNewService_Click(object sender, EventArgs e) { PersonBiz biz = new PersonBiz(); List <DTO.OICADProperties> lsProp = new List <DTO.OICADProperties>(); //ตรวยสอบ Key APP_FOR_OIC ใน Web.config ถ้าไม่มีให้ Default = No //string appForOIC = System.Configuration.ConfigurationManager.AppSettings["APP_FOR_OIC"] == null // ? "Yes" // : System.Configuration.ConfigurationManager.AppSettings["APP_FOR_OIC"].ToUpper(); DTO.ResponseService <DTO.UserProfile> res = biz.UserAuthen(txtUserName.Text.Trim(), txtPassword.Text, true, HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]); if (res.DataResponse != null) { Session[PageList.UserProfile] = res.DataResponse; Session["LoginUser"] = res.DataResponse.LoginName; SetSessionLogin(res.DataResponse); LoggerFactory.CreateLog().LogInfo(String.Format("[{0}] User Login: {1} ", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], res.DataResponse.LoginName)); lblResult.Text = "SUCCESS"; lblResult.Font.Bold = true; lblResult.ForeColor = System.Drawing.Color.BlueViolet; gvADProperties.DataSource = res.DataResponse.CanAccessSystem; gvADProperties.DataBind(); udpMain.Update(); } else { lblResult.Text = "FAIL"; lblResult.Font.Bold = true; lblResult.ForeColor = System.Drawing.Color.Red; gvADProperties.DataSource = null; gvADProperties.DataBind(); udpMain.Update(); } }
//public override void Event_ModifyIndexList(IndexListVM indexListVM, ControllerIndexParams parameters) //{ // base.Event_ModifyIndexList(indexListVM, parameters); // indexListVM.Show.EditDeleteAndCreate = true; //} public override void Fix(ControllerCreateEditParameter parm) { base.Fix(parm); Deliveryman deliveryman = parm.Entity as Deliveryman; if (deliveryman.DeliverymanCategoryId.IsNullOrWhiteSpace()) { deliveryman.DeliverymanCategoryId = null; } if (deliveryman.Name.IsNullOrWhiteSpace()) { if (deliveryman.Person.IsNull()) { deliveryman.PersonId.IsNullOrWhiteSpaceThrowException(); deliveryman.Person = PersonBiz.Find(deliveryman.PersonId); deliveryman.Person.IsNullThrowException(); } deliveryman.Name = deliveryman.Person.Name; } }
//View Mode private void StatusInit() { PersonBiz biz = new PersonBiz(); if (this.MasterPage.UserProfile.Id != null) { DTO.ResponseService <DTO.Person> res = biz.GetById(this.MasterPage.UserProfile.Id); if (res.DataResponse != null) { if (res.DataResponse.STATUS == Convert.ToString((int)DTO.PersonDataStatus.WaitForApprove)) { lblMessage.Text = this.waitApprove; lblMessage.Visible = true; } else if (res.DataResponse.STATUS == Convert.ToString((int)DTO.PersonDataStatus.NotApprove)) { lblMessage.Text = this.notApprove; lblMessage.Visible = true; } } } }
private void prepareTheData(BuySellDoc buySellDoc) { buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException(); if (buySellDoc.Customer.Person.IsNull()) { Customer customer = CustomerBiz.Find(buySellDoc.CustomerId); customer.IsNullThrowException(); buySellDoc.Customer = customer; } buySellDoc.Customer.PersonId.IsNullOrWhiteSpaceThrowException(); if (buySellDoc.Customer.Person.IsNull()) { Person p = PersonBiz.Find(buySellDoc.Customer.PersonId); p.IsNullThrowException(); buySellDoc.Customer.Person = p; } if (buySellDoc.Customer.Person.Addresses.IsNull()) { buySellDoc.Customer.Person.Addresses = new List <AddressMain>(); } }
private void GetSession() { PersonBiz biz = new PersonBiz(); var curUserName = HttpContext.Current.Session["currentusername"]; //if (curUserName != null) if ((curUserName != null) && (SessionsState.ISessionID.Equals(HttpContext.Current.Session.SessionID))) { ResponseMessage <bool> res = biz.SetOffLineStatus(curUserName.ToString()); if (res.ResultMessage == true) { Session["currentusername"] = null; // Session.Clear(); } } else { // Session.Clear(); //Response.Redirect("~/home.aspx"); //Response.Redirect("~/AutoLogout.aspx"); } }
public override async Task <IList <ICommonWithId> > GetListForIndexAsync(ControllerIndexParams parms) { if (UserBiz.IsAdmin(UserId)) { return(await base.GetListForIndexAsync(parms)); } //first get a list of all the people List <Person> peopleList = await PersonBiz.FindAllAsync(); Person person = PersonBiz.GetPersonForUserId(UserId); person.IsNullThrowException("Person not found!"); //now, get all the payment trx for this person List <CashTrx> allTrx = await FindAllAsync(); var allTrxForPerson = allTrx.Where(x => x.PersonFromId == person.Id || x.PersonToId == person.Id).ToList(); //cast and return the list var lstIcommonwithId = allTrxForPerson.Cast <ICommonWithId>().ToList(); return(lstIcommonwithId); }
protected void Page_Load(object sender, EventArgs e) { PersonBiz biz = new PersonBiz(); HttpContext.Current.Session["currentusername"] = "******"; var curUserName = HttpContext.Current.Session["currentusername"]; if (curUserName != null) { ResponseMessage <bool> res = biz.SetOffLineStatus("2491086735245"); if (res.ResultMessage == true) { //Session["currentusername"] = null; //Session.Clear(); //Response.Redirect("~/home.aspx"); } } string logoffDatabase = (this.Request["LogoffDatabase"] == null) ? string.Empty : this.Request["LogoffDatabase"]; string returnValue = string.Empty; if (logoffDatabase == "Y") { if (returnValue.Length > 0) { returnValue += ", "; } returnValue += this.LogoffUser(this.Session["currentusername"].ToString()); } this.Response.ClearHeaders(); this.Response.Clear(); this.Response.Write(returnValue); this.Response.End(); }
private void SetLogoutStatus() { PersonBiz biz = new PersonBiz(); //var curUserName = SessionsState.IUserName; if (HttpContext.Current.Session != null && HttpContext.Current.Session.IsNewSession) { if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies["ASP.NET_SessionId"] != null) { //Get User && SessionID from Auth if ((SessionsState.IUserName != null) && (SessionsState.ISessionID.Equals(HttpContext.Current.Session.SessionID))) { ResponseMessage <bool> res = biz.SetOffLineStatus(SessionsState.IUserName); if (res.ResultMessage == true) { Session["currentusername"] = null; SetSessionLogout(); } } } } }
private string UserAuthen(string appForOIC) { string toPage = "home.aspx"; // string.Empty; PersonBiz biz = new PersonBiz(); //ใช้จริง DTO.ResponseService <DTO.UserProfile> res = biz.UserAuthen(txtUserName.Text.Trim(), txtPassword.Text, (appForOIC == "YES"), GetIPAddress()); if (res.DataResponse != null) { //Set UserName & Type on Site1 //this.CurrentUserName = res.DataResponse.LoginName; //this.SetCurrent(HttpContext.Current.Session.SessionID, res.DataResponse.LoginName, res.DataResponse.LoginStatus, res.DataResponse.MemberType); Session[PageList.UserProfile] = res.DataResponse; Session["LoginUser"] = res.DataResponse.LoginName; SetSessionLogin(res.DataResponse); LoggerFactory.CreateLog().LogInfo(String.Format("[{0}] User Login: {1} ", GetIPAddress(), res.DataResponse.LoginName)); if (res.DataResponse.MemberType == DTO.RegistrationType.General.GetEnumValue()) { //ใช้จริง //toPage = PageList.PersonRegister; //tob edit 04052013 toPage = PageList.FirstPage; } else if (res.DataResponse.MemberType == DTO.RegistrationType.Insurance.GetEnumValue()) { //ใช้จริง //toPage = PageList.CompanyRegister; //tob edit 04052013 toPage = PageList.FirstPage; } else if (res.DataResponse.MemberType == DTO.RegistrationType.Association.GetEnumValue()) { //ใช้จริง //toPage = PageList.AssociateRegister; //tob edit 04052013 toPage = PageList.FirstPage; } else if (res.DataResponse.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) { //ใช้จริง //toPage = PageList.OICRegister; //tob edit 04052013 toPage = PageList.FirstPage; } else if (res.DataResponse.MemberType == DTO.RegistrationType.TestCenter.GetEnumValue()) { //if (res.DataResponse.STATUS == "99") //{ // toPage = PageList.ChangePassword; //} //else //{ //tob edit 27062013 toPage = PageList.FirstPage; //} } else if (res.DataResponse.MemberType == DTO.RegistrationType.OICFinace.GetEnumValue()) { //tob edit 27062013 toPage = PageList.FirstPage; } else if (res.DataResponse.MemberType == DTO.RegistrationType.OICAgent.GetEnumValue()) { //tob edit 27062013 toPage = PageList.FirstPage; } } return(toPage); }