Ejemplo n.º 1
0
        private List <EUserShellModuleRole> ParseUserShellRoleDataSet(DataSet usershellroledataset)
        {
            List <EUserShellModuleRole> returnusershellrole = new List <EUserShellModuleRole>();

            for (int count = 0; count < usershellroledataset.Tables[0].Rows.Count; count++)
            {
                try
                {
                    EUserShellModuleRole usershellrole = new EUserShellModuleRole();

                    usershellrole.UserID        = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["UserID"]);
                    usershellrole.ShellID       = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["ShellID"]);
                    usershellrole.ShellType     = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["ShellType"]);
                    usershellrole.ShellName     = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["Name"]);
                    usershellrole.RoleID        = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["RoleID"]);
                    usershellrole.RoleName      = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["RoleAlias"]); //changed to RoleAlias for "hack"
                    usershellrole.DefaultPage   = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["DefaultPage"]);
                    usershellrole.IsDefault     = Convert.ToBoolean(usershellroledataset.Tables[0].Rows[count]["IsDefault"]);
                    usershellrole.UserName      = Convert.ToString(usershellroledataset.Tables[0].Rows[count]["UserName"]);
                    usershellrole.RoleShellID   = Convert.ToInt32(usershellroledataset.Tables[0].Rows[count]["RoleShellID"]);
                    usershellrole.IsDefaultRole = Convert.ToBoolean(usershellroledataset.Tables[0].Rows[count]["IsDefaultRole"]);

                    returnusershellrole.Add(usershellrole);
                }
                catch
                {
                }
            }
            return(returnusershellrole);
        }
Ejemplo n.º 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;
        EFranchiseeUser franchiseeuser = OrganizationUser.GetFranchiseeUser(currentSession);

        string strtemp = string.Empty;

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

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

        strtemp = ucteamphoto.SaveImage(strfolderpath + "TeamPic" + DateTime.Now.ToString("yyyyMMddhhmmss"));
        if (strtemp != string.Empty)
        {
            franchiseeuser.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)
            {
                franchiseeuser.OtherPictures[icount] = "~/App" + strtemp;
            }
        }

        FranchiseeDAL franchiseeDAL = new FranchiseeDAL();


        EUserShellModuleRole usershellmodulerole1 = new EUserShellModuleRole();

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

        franchiseeDAL.SaveFranchiseeUserImages(franchiseeuser, Convert.ToInt32(EOperationMode.Update), usershellmodulerole1.UserID, usershellmodulerole1.ShellID, usershellmodulerole1.RoleID);

        var strJsCloseWindow = new System.Text.StringBuilder();

        strJsCloseWindow.Append(" <script language = 'Javascript'>window.close(); </script>");
        ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJsCloseWindow.ToString());
    }
Ejemplo n.º 3
0
        public List <EUserShellModuleRole> GetRolesForUserManagement(string username, int roleId, string organization, string userroleid, string franchiseeid)
        {
            SqlParameter[] arParms = new SqlParameter[5];

            arParms[0]       = new SqlParameter("@username", SqlDbType.NVarChar, 500);
            arParms[0].Value = username;

            arParms[1]       = new SqlParameter("@roleid", SqlDbType.Int);
            arParms[1].Value = roleId;

            arParms[2]       = new SqlParameter("@organization", SqlDbType.NVarChar, 500);
            arParms[2].Value = organization;

            arParms[3]       = new SqlParameter("@userroleid", SqlDbType.Int);
            arParms[3].Value = Convert.ToInt32(userroleid);

            arParms[4] = new SqlParameter("@franchiseeid", SqlDbType.BigInt);
            if (franchiseeid == "")
            {
                arParms[4].Value = DBNull.Value;
            }
            else
            {
                arParms[4].Value = Convert.ToInt64(franchiseeid);
            }

            DataSet tempdataset = new DataSet();

            tempdataset = SqlHelper.ExecuteDataset(connectionstring, "usp_getuser", arParms);

            List <EUserShellModuleRole> returnusershellrole = new List <EUserShellModuleRole>();

            foreach (DataRow dr in tempdataset.Tables[0].Rows)
            {
                EUserShellModuleRole usershellrole = new EUserShellModuleRole();

                usershellrole.UserID       = dr["UserID"].ToString();
                usershellrole.UserName     = dr["UserName"].ToString();
                usershellrole.Email        = dr["Email"].ToString();
                usershellrole.IsActive     = Convert.ToBoolean(dr["IsActive"].ToString());
                usershellrole.LoginName    = dr["LoginID"].ToString();
                usershellrole.HintQuestion = dr["HintQuestion"].ToString();
                usershellrole.HintAnswer   = dr["HintAnswer"].ToString();
                usershellrole.IsLocked     = Convert.ToBoolean(dr["IsLocked"].ToString());
                returnusershellrole.Add(usershellrole);
            }

            return(returnusershellrole);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// this function return the modules list for a user in a shell
        /// </summary>
        /// <param name="usershellmodulerole"></param>
        /// <returns></returns>
        public List <Entity.Other.EModule> GetUserRoleModule(EUserShellModuleRole usershellmodulerole)
        {
            SqlParameter[] arParms = new SqlParameter[4];
            arParms[0]       = new SqlParameter("@userid", SqlDbType.BigInt);
            arParms[0].Value = Convert.ToInt64(usershellmodulerole.UserID);
            arParms[1]       = new SqlParameter("@roleid", SqlDbType.BigInt);
            arParms[1].Value = Convert.ToInt64(usershellmodulerole.RoleID);
            arParms[2]       = new SqlParameter("@roletypeid", SqlDbType.BigInt);
            arParms[2].Value = Convert.ToInt64(usershellmodulerole.ShellID);
            arParms[3]       = new SqlParameter("@roletype", SqlDbType.VarChar, 500);
            arParms[3].Value = usershellmodulerole.ShellType;

            DataSet tempdataset = new DataSet();

            tempdataset = SqlHelper.ExecuteDataset(connectionstring, "usp_getuserrolemodule", arParms);

            List <Entity.Other.EModule> returnmodule = new List <Entity.Other.EModule>();

            returnmodule = ParseUserRoleModuleDataSet(tempdataset);
            return(returnmodule);
        }
Ejemplo n.º 5
0
    private bool Savetask()
    {
        Int64 iProspectId = 0;

        var task = new ETask();

        var currentSession = IoC.Resolve <ISessionContext>().UserSession;

        long tempResult;

        task.TaskPriorityType = new ETaskPriorityType();
        task.TaskStatusType   = new ETaskStatusType();

        if (ViewState["TaskID"] != null)
        {
            task.TaskID = Convert.ToInt32(ViewState["TaskID"]);
        }

        task.Subject = txtSubject.Text;
        task.Notes   = TxtNotes.Text;
        task.DueDate = txtduedate.Text;
        task.DueTime = txtStartTime.Text;

        task.TaskStatusType.TaskStatusTypeID     = Convert.ToInt32(ddlStatus.SelectedValue);
        task.TaskPriorityType.TaskPriorityTypeID = Convert.ToInt32(ddlPriority.SelectedValue);
        task.CreatedBY  = Convert.ToInt32(currentSession.CurrentOrganizationRole.OrganizationRoleUserId);
        task.ModifiedBY = Convert.ToInt32(currentSession.CurrentOrganizationRole.OrganizationRoleUserId);

        var role = new EUserShellModuleRole();

        task.UserShellModule = role;

        if (!string.IsNullOrEmpty(Request["ProspectID"]))
        {
            iProspectId = Convert.ToInt64(Request["ProspectID"]);
        }
        task.ProspectID = iProspectId;

        var masterDal = new MasterDAL();

        if (ViewState["TaskID"] != null)
        {
            if (ViewState["TaskID"].ToString() != string.Empty)
            {
                try
                {
                    tempResult = masterDal.SaveTask(task, Convert.ToInt32(EOperationMode.Update), currentSession.UserId.ToString(), currentSession.CurrentOrganizationRole.OrganizationId.ToString(), currentSession.CurrentOrganizationRole.RoleId.ToString());
                }
                catch (Exception)
                {
                    tempResult = -1;
                }

                if (!(tempResult == 999999 || tempResult == -1))
                {
                    tempResult = 9999990;
                }

                //service.UpdateTask(task, usershellmodulerole1, out tempResult, out tempResult1);
            }
        }
        else
        {
            tempResult = masterDal.SaveTask(task, Convert.ToInt32(EOperationMode.Insert), currentSession.UserId.ToString(), currentSession.CurrentOrganizationRole.OrganizationId.ToString(), currentSession.CurrentOrganizationRole.RoleId.ToString());
            if (tempResult == 0)
            {
                tempResult = 9999990;
            }
        }

        // Assign prospect to salesrep
        if (iProspectId > 0)
        {
            if (currentSession.CurrentOrganizationRole.CheckRole((long)Roles.SalesRep))
            {
                var franchisorDal = new FranchisorDAL();
                franchisorDal.AssignProspect(1, iProspectId, Convert.ToInt64(currentSession.UserId));
            }
        }
        if (Request.QueryString["Referrer"] != null)
        {
            string strReferrer = Request.QueryString["Referrer"];
            if ((strReferrer != string.Empty) && (strReferrer == "Calendar"))
            {
                Response.RedirectUser(ResolveUrl("~/App/Common/Calendar.aspx"));
            }
        }
        return(true);
    }
    private void SaveMedicalVendor()
    {
        OtherDAL otherDal = new OtherDAL();
        EZip objczip;

        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        objczip = otherDal.CheckCityZip(txtCity.Text, txtZip.Text, ddlState.SelectedValue);

        if (objczip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('City name entered for contact address is not valid.');", true);
            return;
        }
        else if (objczip.CityID > 0 && objczip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('Zip Code entered for contact address, corresponding to its city name, is not valid.');", true);
            return;
        }

        EMVMVUser emvmvUser = new EMVMVUser();
        EMedicalVendor medicalVendor = new EMedicalVendor();

        if (ViewState["AuditRequired"] != null)
            emvmvUser.AuditRequired = Convert.ToBoolean(ViewState["AuditRequired"]);

        medicalVendor.BusinessName = ddlVendorName.SelectedItem.Text;
        if (ViewState["MedicalVendorID"] != null)
        {
            medicalVendor.MedicalVendorID = Convert.ToInt32(ViewState["MedicalVendorID"].ToString());
        }
        else
            medicalVendor.MedicalVendorID = Convert.ToInt32(ddlVendorName.SelectedValue);
        EAddress address = new EAddress();
        address.Address1 = txtAddress1.Text;
        address.Address2 = txtAddress2.Text;
        address.CityID = objczip.CityID;
        address.StateID = Convert.ToInt32(ddlState.SelectedValue);
        address.CountryID = Convert.ToInt32(hfCountryID.Value);
        address.ZipID = objczip.ZipID;

        EUser user = new EUser();
        if (ViewState["UserID"] != null)
        {
            user.UserID = Convert.ToInt32(ViewState["UserID"].ToString());
        }
        user.FirstName = txtFirstName.Text;
        user.MiddleName = txtMiddleName.Text;
        user.LastName = txtLastName.Text;
        user.PhoneCell = objCommonCode.FormatPhoneNumber(txtPhoneC.Text);
        user.PhoneHome = objCommonCode.FormatPhoneNumber(txtPhoneH.Text);
        user.PhoneOffice = objCommonCode.FormatPhoneNumber(txtPhoneO.Text);
        user.DOB = txtDOB.Text;
        user.SSN = txtSSN.Text;
        user.EMail1 = txtEmail1.Text;
        user.EMail2 = txtEmail2.Text;

        user.HomeAddress = address;

        var reference = new EReferences[3];
        reference[0] = new EReferences { Name = string.Empty, EMail = string.Empty };
        reference[1] = new EReferences { Name = string.Empty, EMail = string.Empty };
        reference[2] = new EReferences { Name = string.Empty, EMail = string.Empty };

        EMVUserSpecialization userSpecialization = new EMVUserSpecialization();
        userSpecialization.MVUserSpecilaizationID = Convert.ToInt32(ddlSpecialization.SelectedValue);

        EMVUserClassification emvUserClassification = new EMVUserClassification();
        emvUserClassification.MVUserClassificationID = Convert.ToInt32(ViewState["ClassificationID"]);


        EMVUser emvUser = new EMVUser();
        Ucupdatephotopanel1.GetAllImages();
        emvUser.OtherPictures = Ucupdatephotopanel1.Images;
        emvUser.MyPicture = Ucupdatephotopanel1.MyImage;


        if (ViewState["MVUserID"] != null)
        {
            emvUser.MVUserID = Convert.ToInt32(ViewState["MVUserID"].ToString());
        }
        emvUser.User = user;
        emvUser.References = reference.ToList();
        emvUser.MVUserSpecialization = userSpecialization;
        emvUser.MVUserClassification = emvUserClassification;
        emvUser.Address = address;
        //// For Resume
        string resumePath = ViewState["Resume"].ToString();
        string signPath = ViewState["Signature"].ToString();
        if ((hfResume.Value == "1") && fileResume.HasFile)
        {
            string filePath = Request.MapPath(ConfigurationManager.AppSettings["MVUploadResume"].ToString());
            resumePath = ConfigurationManager.AppSettings["MVUploadResume"].ToString();
            var fileInfo = new FileInfo(fileResume.FileName);
            if (!(fileInfo.Extension.Equals(".doc") || fileInfo.Extension.Equals(".docx") || fileInfo.Extension.Equals(".rtf") || fileInfo.Extension.Equals(".txt")))
            {
                divErrorMsg.Visible = true;
                divErrorMsg.InnerHtml = "Invalid file format. It should be either of type doc, docx, rtf or txt";
                return;
            }
            else
            {
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                string saveFileName = fileResume.FileName + DateTime.Now.ToFileTimeUtc() + fileInfo.Extension;
                if (fileResume.HasFile)
                {
                    fileResume.SaveAs(filePath + "\\" + saveFileName);
                }
                resumePath = resumePath + "/" + saveFileName;
            }
        }
        emvUser.Resume = resumePath;
        ////////////////////////signature//////////////////////////////////
        if ((hfSignature.Value == "1") && (fileSignature.FileName.Trim() != ""))
        {
            if (fileSignature.HasFile)
            {
                string signFilePath = Request.MapPath(ConfigurationManager.AppSettings["MVUploadSignature"].ToString());
                signPath = ConfigurationManager.AppSettings["MVUploadSignature"].ToString();

                var fileInfo = new FileInfo(fileSignature.FileName);
                if (!(fileInfo.Extension.ToLower().Equals(".jpeg") || fileInfo.Extension.ToLower().Equals(".jpg")))
                {
                    divErrorMsg.Visible = true;
                    divErrorMsg.InnerHtml = "Please Check the file extension.It should be either of type jpg or jpeg";
                    return;
                }
                else
                {
                    if (!Directory.Exists(signFilePath))
                    {
                        Directory.CreateDirectory(signFilePath);
                    }
                    string saveFileName = fileSignature.FileName.Substring(0, fileSignature.FileName.IndexOf(".")) + DateTime.Now.ToFileTimeUtc() + fileInfo.Extension;
                    if (fileSignature.HasFile)
                    {
                        fileSignature.PostedFile.SaveAs(signFilePath + "\\" + saveFileName);
                    }
                    signPath = signPath + "/" + saveFileName;
                }
            }
        }

        emvUser.DigitalSignature = signPath;
        emvmvUser.MedicalVendor = medicalVendor;

        if (ViewState["IsAuthorizationAllowed"] != null)
            emvmvUser.IsAuthorizationsAllowed = Convert.ToBoolean(ViewState["IsAuthorizationAllowed"]);

        if (ViewState["CutoffDate"] != null)
            emvmvUser.CutOffDate = ViewState["CutoffDate"].ToString();
        if (ViewState["ShowEarningAmount"] != null)
            emvmvUser.ShowEarningAmount = Convert.ToBoolean(ViewState["ShowEarningAmount"]);

        emvmvUser.MVUser = emvUser;

        Int64 returnresult;

        var eUserShellModuleRole = new EUserShellModuleRole
                                                        {
                                                            RoleID = "1",
                                                            ShellID = "1",
                                                            UserID = "1"
                                                        };

        var medicalvendorDal = new MedicalVendorDAL();
        returnresult = medicalvendorDal.SaveMedicalVendorUserProfile(emvmvUser, Convert.ToInt32(EOperationMode.Update), eUserShellModuleRole.UserID, Convert.ToInt64(eUserShellModuleRole.ShellID), eUserShellModuleRole.RoleID);

        if (txtPassword.Text.Length > 0)
        {
            var userLoginService = IoC.Resolve<IUserLoginService>();
            var userContext = IoC.Resolve<SessionContext>();
            userLoginService.ResetPassword(Convert.ToInt32(userContext.UserSession.UserId), txtPassword.Text, false, userContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId,false);
        }

        Response.RedirectUser(this.ResolveUrl("MedicalVendorUserProfile.aspx"));
    }