public static EFranchisorUser GetFranchisorUser(UserSessionModel objSession) { Int32 userid = Convert.ToInt32(objSession.UserId); Int32 shellid = Convert.ToInt32(objSession.CurrentOrganizationRole.OrganizationId); var franchisorDal = new FranchisorDAL(); var franchisoruserList = franchisorDal.GetFranchisorUser(shellid.ToString(), userid.ToString(), 1); if (franchisoruserList != null && franchisoruserList.Count > 0) { return(franchisoruserList[0]); } return(null); }
private void FillFranchisorData() { Int32 userid = Convert.ToInt32(IoC.Resolve <ISessionContext>().UserSession.UserId); Int32 shellid = Convert.ToInt32(IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationId); // format phone no. CommonCode objCommonCode = new CommonCode(); FranchisorDAL franchisorDAL = new FranchisorDAL(); var franchisoruser = franchisorDAL.GetFranchisorUser(shellid.ToString(), userid.ToString(), 1); if (franchisoruser != null) { name.InnerText = franchisoruser[0].User.FirstName + " " + franchisoruser[0].User.MiddleName + " " + franchisoruser[0].User.LastName; spfrnchname.InnerText = franchisoruser[0].User.FirstName; spfrnchmname.InnerText = franchisoruser[0].User.MiddleName; spfrnchLname.InnerText = franchisoruser[0].User.LastName; DateTime DOB = Convert.ToDateTime(franchisoruser[0].User.DOB); dvRole.InnerText = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.RoleDisplayName; spaddress1.InnerText = franchisoruser[0].Address.Address1; spaddress2.InnerText = franchisoruser[0].Address.Address2; spState.InnerText = franchisoruser[0].Address.State; spCountry.InnerText = franchisoruser[0].Address.Country; spCity.InnerText = franchisoruser[0].Address.City; spZip.InnerText = franchisoruser[0].Address.Zip; sptelHome.InnerText = objCommonCode.FormatPhoneNumberGet(franchisoruser[0].User.PhoneHome); sptelCell.InnerText = objCommonCode.FormatPhoneNumberGet(franchisoruser[0].User.PhoneCell); sptelOther.InnerText = objCommonCode.FormatPhoneNumberGet(franchisoruser[0].User.PhoneOffice); spemail1.InnerText = franchisoruser[0].User.EMail1; spemail2.InnerText = franchisoruser[0].User.EMail2; spdob.InnerText = DOB.ToString("MMMM dd, yyyy"); spssn.InnerText = franchisoruser[0].User.SSN; CommonCode objCCode = new CommonCode(); imgmyphto.ImageUrl = objCCode.GetPicture(Request.MapPath(franchisoruser[0].MyPicture), franchisoruser[0].MyPicture); imgmyteam.ImageUrl = objCCode.GetPicture(Request.MapPath(franchisoruser[0].TeamPicture), franchisoruser[0].TeamPicture); Ucimagelist1.Images = franchisoruser[0].OtherPictures; //var listImage = new List<string>(); //foreach (var strImage in franchisoruser[0].OtherPictures) //{ // listImage.Add(strImage); //} //Ucimagelist1.Images = listImage; spDesc.InnerText = franchisoruser[0].ShellDescription; } }
protected void btnupdatedown_Click(object sender, EventArgs e) { string strfolderpath = "/Images/TestUpload/"; // Loop through each Image control var currentSession = IoC.Resolve <ISessionContext>().UserSession; EFranchisorUser franchisoruser = OrganizationUser.GetFranchisorUser(currentSession); string strtemp = string.Empty; strtemp = ucmyphoto.SaveImage(strfolderpath + "MyPic" + DateTime.Now.ToString("yyyyMMddhhmmss")); if (strtemp != string.Empty) { franchisoruser.MyPicture = "~/App" + strtemp; } strtemp = ucteamphoto.SaveImage(strfolderpath + "TeamPic" + DateTime.Now.ToString("yyyyMMddhhmmss")); if (strtemp != string.Empty) { franchisoruser.TeamPicture = "~/App" + strtemp; } ISettings settings = IoC.Resolve <ISettings>(); Int32 intMaxPicCount = settings.MaximumPictureCount; for (Int16 icount = 0; icount < intMaxPicCount; icount++) { UCCommon_ucphotopanel Ucphotopanel1 = (UCCommon_ucphotopanel)grdphotoother.Rows[icount].FindControl("Ucphotopanel1"); strtemp = Ucphotopanel1.SaveImage(strfolderpath + icount + DateTime.Now.ToString("yyyyMMddhhmmss")); if (strtemp != string.Empty) { franchisoruser.OtherPictures[icount] = "~/App" + strtemp; } } Int64 returnresult; FranchisorDAL franchisorDal = new FranchisorDAL(); returnresult = franchisorDal.SaveFranchisorUserImages(franchisoruser, Convert.ToInt32(EOperationMode.Update), currentSession.UserId.ToString(), currentSession.CurrentOrganizationRole.OrganizationId.ToString(), currentSession.CurrentOrganizationRole.RoleId.ToString()); if (returnresult == 0) { returnresult = 9999991; } var listfranchisoruser = franchisorDal.GetFranchisorUser(currentSession.CurrentOrganizationRole.OrganizationId.ToString(), currentSession.UserId.ToString(), 1); if (listfranchisoruser != null && listfranchisoruser.Count > 0) { franchisoruser = listfranchisoruser[0]; } System.Text.StringBuilder strJSCloseWindow = new System.Text.StringBuilder(); strJSCloseWindow.Append(" <script language = 'Javascript'>window.close(); </script>"); ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJSCloseWindow.ToString()); }