Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Users objUsers = new Users();
            objUsers.UserTypeID = Convert.ToInt32(ddlUserType.SelectedValue);
            objUsers.FullName = txtFullName.Text.Trim();
            objUsers.UserName = txtUserName.Text.Trim();
            objUsers.Password = txtPassword.Text.Trim();
            if (!String.IsNullOrEmpty(ddlDistrict.SelectedValue))
                objUsers.DistrictID = Convert.ToInt32(ddlDistrict.SelectedValue);
            if (!String.IsNullOrEmpty(ddlSaMIOrganization.SelectedValue))
                objUsers.SaMIOrganizationID = Convert.ToInt32(ddlSaMIOrganization.SelectedValue);
            if (!String.IsNullOrEmpty(ddlPartner.SelectedValue))
                objUsers.PartnerID = Convert.ToInt32(ddlPartner.SelectedValue);
            if (!String.IsNullOrEmpty(ddlSkillPartner.SelectedValue))
                objUsers.SkillPartnerID = Convert.ToInt32(ddlSkillPartner.SelectedValue);

            objUsers.CreatedBy = UserAuthentication.GetUserId(this.Page);
            objUsers.CreatedDate = DateTime.Now;
            if(UserBO.IsUserExists(txtUserName.Text.Trim()))
            {
                lblStatus.Text = "User Name: " + txtUserName.Text + " already exists.";
                lblStatus.Visible = true;
            }
            else
            {
                objUsers.SyncStatus = 0;
                UserBO.InsertUser(objUsers);
                Response.Redirect("Index.aspx");
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Users objUsers = new Users();
            int userID = Convert.ToInt32(Request.QueryString.Get("ID"));
            objUsers.UserID = userID;

            DataView dvUsers = UserBO.SelectByUserId(userID);
            if (!String.IsNullOrEmpty(dvUsers.Table.Rows[0]["UserTypeID"].ToString()))
                objUsers.UserTypeID = Convert.ToInt32(dvUsers.Table.Rows[0]["UserTypeID"]);
            objUsers.FullName = txtFullName.Text;
            if (!String.IsNullOrEmpty(dvUsers.Table.Rows[0]["DistrictID"].ToString()))
                objUsers.DistrictID = Convert.ToInt32(dvUsers.Table.Rows[0]["DistrictID"]);
            if (!String.IsNullOrEmpty(dvUsers.Table.Rows[0]["PartnerID"].ToString()))
                objUsers.PartnerID = Convert.ToInt32(dvUsers.Table.Rows[0]["PartnerID"]);
            if (!String.IsNullOrEmpty(dvUsers.Table.Rows[0]["SaMIOrganizationID"].ToString()))
                objUsers.SaMIOrganizationID = Convert.ToInt32(dvUsers.Table.Rows[0]["SaMIOrganizationID"]);
            objUsers.Password = txtNewPassword.Text;
            if (!String.IsNullOrEmpty(objUsers.Password))
                objUsers.Password = AppCommonBO.EncodeUserPassword(objUsers.Password);

            objUsers.UpdatedBy = UserAuthentication.GetUserId(this.Page);
            objUsers.UpdatedDate = DateTime.Now;
            objUsers.SyncStatus = 0;

            UserBO.UpdateUser(objUsers);
            //UserBO.ChangePassword(objUsers);
            Response.Redirect("Index.aspx");
        }
Esempio n. 3
0
 // GET api/user
 public IEnumerable<Users> Get(int Organization)
 {
  
     List<Users> listUsers = new List<Users>();
     DataView dvUser = UserBO.GetAllUsersIDByOrganizationID(Organization);
     foreach (DataRowView drvUser in dvUser)
     {
         Users users = new Users();
         listUsers.Add(UserBO.GetUser(Convert.ToInt32(drvUser["UserID"])));
     }
     return listUsers;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int userID = Convert.ToInt32(Request.QueryString.Get("ID"));

                Users objUsers = new Users();
                objUsers = UserBO.GetUser(userID);
                txtFullName.Text = objUsers.FullName;
                txtUserName.Text = objUsers.UserName;

            }
        }
        // POST api/userauthentication
        public Boolean Post(Users user)
        {
            
            controllers.UserValid.ValidUser= UserBO.CheckUserAuthentication(user.UserName, user.Password);

            if (controllers.UserValid.ValidUser)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 6
0
        // POST api/user
        public Users Post(Users user)
        {
            if (user.GUID > 0)
            {
                user.UserID = user.GUID;
                int rowResult = UserBO.UpdateUser(user);

                //Return Back to The Client               
                return user;
            }
            else
            {                               
                int rowResult = UserBO.InsertUser(user);

                //Return Back to The Client               
                return user;
            }
        }
Esempio n. 7
0
        public int InsertUser(Users objUsers)
        {
            objUsers.UserID = 1;
            BeginTransaction();

            try
            {
                objUsers.UserID = Insert(objUsers);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objUsers.UserID = -1;
            }

            return objUsers.UserID;
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadOptions();

                int userID = Convert.ToInt32(Request.QueryString.Get("ID"));

                Users objUsers = new Users();
                objUsers = UserBO.GetUser(userID);

                ddlUserType.SelectedValue = objUsers.UserTypeID.ToString();
                txtFullName.Text = objUsers.FullName;
                txtUserName.Text = objUsers.UserName;
                ddlDistrict.SelectedValue = objUsers.DistrictID.ToString();
                ddlPartner.SelectedValue = objUsers.PartnerID.ToString();
                ddlSkillPartner.SelectedValue = objUsers.SkillPartnerID.ToString();


                ddlSaMIOrganization.DataSource = SaMIOrganizationBO.GetOrganizationByDistrictID(Convert.ToInt32(objUsers.DistrictID), "");
                ddlSaMIOrganization.DataValueField = "SaMIOrganizationID";
                ddlSaMIOrganization.DataTextField = "SaMIOrganizationName";
                ddlSaMIOrganization.DataBind();

                ddlSaMIOrganization.SelectedValue = objUsers.SaMIOrganizationID.ToString();

                if (objUsers.PartnerID > 0)
                {
                    ddlPartner.Enabled = true;
                    ddlSaMIOrganization.Enabled = false;
                }

                if (objUsers.SkillPartnerID > 0)
                {
                    ddlSkillPartner.Enabled = true;
                    ddlSaMIOrganization.Enabled = false;
                }

            }
        }
Esempio n. 9
0
        public static Users GetUser(int userID)
        {
            Users objUsers = new Users();
            return (Users)(new UserDAO().FillDTO(objUsers, "UserID=" + userID));

        }
Esempio n. 10
0
 public static int UpdateUser(Users objUsers)
 {
     //if(!String.IsNullOrEmpty(objUsers.Password))
        // objUsers.Password = AppCommonBO.EncodeUserPassword(objUsers.Password);
     return new UserDAO().UpdateUser(objUsers);
 }
Esempio n. 11
0
 public static int InsertUser(Users objUsers)
 {
     objUsers.Password = AppCommonBO.EncodeUserPassword(objUsers.Password);
     return new UserDAO().InsertUser(objUsers);
 }
Esempio n. 12
0
 public static int ChangePassword(Users objUsers)
 {
     objUsers.Password = AppCommonBO.EncodeUserPassword(objUsers.Password);
     return new UserDAO().ChangePassword(objUsers);
 }
Esempio n. 13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Users objUsers = new Users();
            objUsers.UserTypeID = Convert.ToInt32(ddlUserType.SelectedValue);
            objUsers.FullName = txtFullName.Text;
            if (!String.IsNullOrEmpty(ddlDistrict.SelectedValue))
                objUsers.DistrictID = Convert.ToInt32(ddlDistrict.SelectedValue);
            if (!String.IsNullOrEmpty(ddlPartner.SelectedValue))
                objUsers.PartnerID = Convert.ToInt32(ddlPartner.SelectedValue);
            if (!String.IsNullOrEmpty(ddlSaMIOrganization.SelectedValue))
                objUsers.SaMIOrganizationID = Convert.ToInt32(ddlSaMIOrganization.SelectedValue);
            int userID = Convert.ToInt32(Request.QueryString.Get("ID"));
            objUsers.UserID = userID;
            objUsers.Password = txtPassword.Text;
            objUsers.UpdatedBy = UserAuthentication.GetUserId(this.Page);
            objUsers.UpdatedDate = DateTime.Now;
            objUsers.SyncStatus = 0;
            UserBO.UpdateUser(objUsers);

            Response.Redirect("Index.aspx");
        }
Esempio n. 14
0
        public int UpdateUser(Users objUsers)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "FullName", "DistrictID", "Password", "UserTypeID", "PartnerID", "UpdatedBy", "UpdatedDate", "SaMIOrganizationID","SyncStatus" };
                rowsaffected = Update(objUsers, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
Esempio n. 15
0
        public int ChangePassword(Users objUsers)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Password", "UpdatedBy", "UpdatedDate", "SyncStatus" };
                rowsaffected = Update(objUsers, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }