Пример #1
0
 public static USER_RoleWiseAccess GetUSER_RoleWiseAccessByID(int ID)
 {
     USER_RoleWiseAccess uSER_RoleWiseAccess = new USER_RoleWiseAccess();
     SqlUSER_RoleWiseAccessProvider sqlUSER_RoleWiseAccessProvider = new SqlUSER_RoleWiseAccessProvider();
     uSER_RoleWiseAccess = sqlUSER_RoleWiseAccessProvider.GetUSER_RoleWiseAccessByID(ID);
     return uSER_RoleWiseAccess;
 }
Пример #2
0
 public static USER_RoleWiseAccess GetUserRowStatusByRowStatusID(int RowStatusID)
 {
     USER_RoleWiseAccess uSER_RoleWiseAccess = new USER_RoleWiseAccess();
     SqlUSER_RoleWiseAccessProvider sqlUSER_RoleWiseAccessProvider = new SqlUSER_RoleWiseAccessProvider();
     uSER_RoleWiseAccess = sqlUSER_RoleWiseAccessProvider.GetUSER_RoleWiseAccessByRowStatusID(RowStatusID);
     return uSER_RoleWiseAccess;
 }
Пример #3
0
 public static USER_RoleWiseAccess GetUserOperationByOperationID(int OperationID)
 {
     USER_RoleWiseAccess uSER_RoleWiseAccess = new USER_RoleWiseAccess();
     SqlUSER_RoleWiseAccessProvider sqlUSER_RoleWiseAccessProvider = new SqlUSER_RoleWiseAccessProvider();
     uSER_RoleWiseAccess = sqlUSER_RoleWiseAccessProvider.GetUSER_RoleWiseAccessByOperationID(OperationID);
     return uSER_RoleWiseAccess;
 }
Пример #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (ddlRoleID.SelectedIndex > 0)
            {
                foreach (GridViewRow row in gvPagesAndAccess.Rows)
                {
                    string roleName = ddlRoleID.SelectedValue;
                    HiddenField hfPageID = (HiddenField)row.FindControl("hfPageID");
                    int pageID = Convert.ToInt32(hfPageID.Value);
                    USER_RoleWiseAccess uSER_RoleWiseAccess = new USER_RoleWiseAccess();
                    uSER_RoleWiseAccess.PageID = pageID;
                    uSER_RoleWiseAccess.RoleID = roleName;

                    uSER_RoleWiseAccess.AddedBy = "Admin";
                    uSER_RoleWiseAccess.AddedDate = DateTime.Now;
                    uSER_RoleWiseAccess.UpdatedBy = "Admin";
                    uSER_RoleWiseAccess.UpdatedDate = DateTime.Now;

                    CheckBox cbAssigned = (CheckBox)row.FindControl("cbAssigned");
                    if (cbAssigned.Checked)
                        uSER_RoleWiseAccess.RowStatusID = (int)Enums.RowStatus.Active;//Here is something to do later.
                    else
                        uSER_RoleWiseAccess.RowStatusID = (int)Enums.RowStatus.Deleted;

                    CheckBoxList cblOperations = (CheckBoxList)row.FindControl("cblOperations");
                    foreach (ListItem li in cblOperations.Items)
                    {
                        uSER_RoleWiseAccess.OperationID = int.Parse(li.Value);
                        uSER_RoleWiseAccess.Access = li.Selected;

                        int resutl = USER_RoleWiseAccessManager.InsertUSER_RoleWiseAccess(uSER_RoleWiseAccess);
                    }
                }
                _loadPages();
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #5
0
 public static bool UpdateUSER_RoleWiseAccess(USER_RoleWiseAccess uSER_RoleWiseAccess)
 {
     SqlUSER_RoleWiseAccessProvider sqlUSER_RoleWiseAccessProvider = new SqlUSER_RoleWiseAccessProvider();
     return sqlUSER_RoleWiseAccessProvider.UpdateUSER_RoleWiseAccess(uSER_RoleWiseAccess);
 }
Пример #6
0
 public static int InsertUSER_RoleWiseAccess(USER_RoleWiseAccess uSER_RoleWiseAccess)
 {
     SqlUSER_RoleWiseAccessProvider sqlUSER_RoleWiseAccessProvider = new SqlUSER_RoleWiseAccessProvider();
     return sqlUSER_RoleWiseAccessProvider.InsertUSER_RoleWiseAccess(uSER_RoleWiseAccess);
 }
Пример #7
0
    public bool UpdateUSER_RoleWiseAccess(USER_RoleWiseAccess uSER_RoleWiseAccess)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateUSER_RoleWiseAccess", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ID", SqlDbType.Int).Value = uSER_RoleWiseAccess.ID;
            cmd.Parameters.Add("@PageID", SqlDbType.Int).Value = uSER_RoleWiseAccess.PageID;
            cmd.Parameters.Add("@RoleID", SqlDbType.NVarChar).Value = uSER_RoleWiseAccess.RoleID;
            cmd.Parameters.Add("@OperationID", SqlDbType.Int).Value = uSER_RoleWiseAccess.OperationID;
            cmd.Parameters.Add("@Access", SqlDbType.Bit).Value = uSER_RoleWiseAccess.Access;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = uSER_RoleWiseAccess.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = uSER_RoleWiseAccess.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = uSER_RoleWiseAccess.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Пример #8
0
    public USER_RoleWiseAccess GetUSER_RoleWiseAccessFromReader(IDataReader reader)
    {
        try
        {
            USER_RoleWiseAccess uSER_RoleWiseAccess = new USER_RoleWiseAccess
                (

                     DataAccessObject.IsNULL<int>(reader["ID"]),
                     DataAccessObject.IsNULL<int>(reader["PageID"]),
                     DataAccessObject.IsNULL<string>(reader["RoleID"].ToString()),
                     DataAccessObject.IsNULL<int>(reader["OperationID"]),
                     DataAccessObject.IsNULL<bool>(reader["Access"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"]),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"]),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdatedDate"]),
                     DataAccessObject.IsNULL<int>(reader["RowStatusID"])
                );
             return uSER_RoleWiseAccess;
        }
        catch(Exception ex)
        {
            return null;
        }
    }