Ejemplo n.º 1
0
 /// <summary>
 /// Function to Update password
 /// </summary>
 /// <param name="userinfo"></param>
 public void ChangePasswordEdit(UserInfo userinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ChangePasswordEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = userinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@userName", SqlDbType.VarChar);
         sprmparam.Value = userinfo.UserName;
         sprmparam = sccmd.Parameters.Add("@password", SqlDbType.VarChar);
         sprmparam.Value = userinfo.Password;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Ejemplo n.º 2
0
 public void UserAdd(UserInfo infoUser)
 {
     UserSP spUser = new UserSP();
     try
     {
         spUser.UserAdd(infoUser);
     }
     catch (Exception ex)
     {
         MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Function to get particular values from account group table based on the parameter
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public UserInfo UserView(decimal userId)
        {
            UserInfo infoUser = new UserInfo();
            UserSP spUser = new UserSP();
            try
            {
                infoUser=spUser.UserView( userId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return infoUser;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Function to get particular values from account group table based on the parameter
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public UserInfo UserView(decimal userId)
 {
     UserInfo userinfo = new UserInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("UserView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = userId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             userinfo.UserId = decimal.Parse(sdrreader[0].ToString());
             userinfo.UserName = sdrreader[1].ToString();
             userinfo.Password = sdrreader[2].ToString();
             userinfo.Active = bool.Parse(sdrreader[3].ToString());
             userinfo.RoleId = decimal.Parse(sdrreader[4].ToString());
             userinfo.Narration = sdrreader[5].ToString();
             userinfo.ExtraDate = DateTime.Parse(sdrreader[6].ToString());
             userinfo.Extra1 = sdrreader[7].ToString();
             userinfo.Extra2 = sdrreader[8].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return userinfo;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Function to insert values to account group Table
 /// </summary>
 /// <param name="userinfo"></param>
 public void UserAdd(UserInfo userinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("UserAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@userName", SqlDbType.VarChar);
         sprmparam.Value = userinfo.UserName;
         sprmparam = sccmd.Parameters.Add("@password", SqlDbType.VarChar);
         sprmparam.Value = userinfo.Password;
         sprmparam = sccmd.Parameters.Add("@active", SqlDbType.Bit);
         sprmparam.Value = userinfo.Active;
         sprmparam = sccmd.Parameters.Add("@roleId", SqlDbType.Decimal);
         sprmparam.Value = userinfo.RoleId;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = userinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = userinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = userinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }