コード例 #1
0
    protected void btnupdatedown_Click(object sender, EventArgs e)
    {
        string strfolderpath = "/Images/TestUpload/";
        // Loop through each Image control
        var currentSession = IoC.Resolve <ISessionContext>().UserSession;

        EFranchiseeUser franchiseeuser = OrganizationUser.GetFranchiseeUser(currentSession);

        string strtemp = string.Empty;

        strtemp = ucmyphoto.SaveImage(strfolderpath + "MyPic" + DateTime.Now.ToString("yyyyMMddhhmmss"));

        if (strtemp != string.Empty)
        {
            franchiseeuser.MyPicture = "~" + strtemp;
        }

        strtemp = ucteamphoto.SaveImage(strfolderpath + "TeamPic" + DateTime.Now.ToString("yyyyMMddhhmmss"));
        if (strtemp != string.Empty)
        {
            franchiseeuser.TeamPicture = "~" + strtemp;
        }

        for (Int16 icount = 0; icount < 12; icount++)
        {
            UCCommon_ucphotopanel Ucphotopanel1 = (UCCommon_ucphotopanel)grdphotoother.Rows[icount].FindControl("Ucphotopanel1");
            strtemp = Ucphotopanel1.SaveImage(strfolderpath + icount + DateTime.Now.ToString("yyyyMMddhhmmss"));

            if (strtemp != string.Empty)
            {
                franchiseeuser.OtherPictures[icount] = "~" + strtemp;
            }
        }

        var usershellmodulerole1 = new Falcon.Entity.User.EUserShellModuleRole();

        usershellmodulerole1.RoleID  = currentSession.CurrentOrganizationRole.RoleId.ToString();
        usershellmodulerole1.ShellID = currentSession.CurrentOrganizationRole.OrganizationId.ToString();
        usershellmodulerole1.UserID  = currentSession.UserId.ToString();

        var franchiseeDal = new FranchiseeDAL();

        long returnresult = franchiseeDal.SaveFranchiseeUserImages(franchiseeuser, Convert.ToInt32(EOperationMode.Update), usershellmodulerole1.UserID, usershellmodulerole1.ShellID, usershellmodulerole1.RoleID);

        if (returnresult == 0)
        {
            returnresult = 9999991;
        }

        System.Text.StringBuilder strJSCloseWindow = new System.Text.StringBuilder();
        strJSCloseWindow.Append(" <script language = 'Javascript'>window.close(); </script>");
        ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJSCloseWindow.ToString());
    }
コード例 #2
0
    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());
    }