Exemplo n.º 1
0
        private List <RoleMasterPOCO> ConvertDataTableToRole(DataSet ds)
        {
            List <RoleMasterPOCO> roleMasterPOCOs = new List <RoleMasterPOCO>();

            //check if there is at all any data
            if (ds.Tables.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    RoleMasterPOCO pPOCOPC = new RoleMasterPOCO();

                    if (item["Id"] != null)
                    {
                        pPOCOPC.RoleId = Convert.ToInt32(item["Id"].ToString());
                    }

                    if (item["RoleName"] != System.DBNull.Value)
                    {
                        pPOCOPC.RoleName = item["RoleName"].ToString();
                    }

                    roleMasterPOCOs.Add(pPOCOPC);
                }
            }
            return(roleMasterPOCOs);
        }
Exemplo n.º 2
0
        private RoleMasterPOCO ConvertDataTableToRoleMasterByRoleIdList(DataSet ds)
        {
            RoleMasterPOCO pPOCOPC = new RoleMasterPOCO();

            //check if there is at all any data
            if (ds.Tables.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    //UserMasterPOCO pPOCOPC = new UserMasterPOCO();

                    if (item["RoleId"] != null)
                    {
                        pPOCOPC.RoleId = Convert.ToInt32(item["RoleId"].ToString());
                    }

                    if (item["RoleName"] != System.DBNull.Value)
                    {
                        pPOCOPC.RoleName = item["RoleName"].ToString();
                    }

                    //if (item["CreatedBy"] != System.DBNull.Value)
                    //    pPOCOPC.CreatedBy = item["CreatedBy"].ToString();

                    //if (item["ModifiedBy"] != System.DBNull.Value)
                    //    pPOCOPC.ModifiedBy = item["ModifiedBy"].ToString();

                    //pcList.Add(pPOCOPC);
                }
            }
            return(pPOCOPC);
        }
Exemplo n.º 3
0
        public JsonResult SaveUpdateRoleMaster(RoleMasterPOCO pOCO)
        {
            RoleMasterBL   bL = new RoleMasterBL();
            RoleMasterPOCO pC = new RoleMasterPOCO();

            pC.RoleId = pOCO.RoleId;

            pC.RoleName   = pOCO.RoleName;
            pC.CreatedBy  = pOCO.CreatedBy;
            pC.ModifiedBy = pOCO.ModifiedBy;

            return(Json(bL.SaveUpdateRoleMaster(pC /*, int.Parse(Session["VesselID"].ToString())*/), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult LoadData()
        {
            int draw, start, length;
            int pageIndex = 0;

            if (null != Request.Form.GetValues("draw"))
            {
                draw   = int.Parse(Request.Form.GetValues("draw").FirstOrDefault().ToString());
                start  = int.Parse(Request.Form.GetValues("start").FirstOrDefault().ToString());
                length = int.Parse(Request.Form.GetValues("length").FirstOrDefault().ToString());
            }
            else
            {
                draw   = 1;
                start  = 0;
                length = 500;
            }

            if (start == 0)
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = (start / length) + 1;
            }

            RoleMasterBL bL           = new RoleMasterBL();
            int          totalrecords = 0;

            List <RoleMasterPOCO> pocoList = new List <RoleMasterPOCO>();

            pocoList = bL.GetAllRoleMasterPageWise(pageIndex, ref totalrecords, length /*, int.Parse(Session["VesselID"].ToString())*/);
            List <RoleMasterPOCO> pList = new List <RoleMasterPOCO>();

            foreach (RoleMasterPOCO pC in pocoList)
            {
                RoleMasterPOCO pOCO = new RoleMasterPOCO();
                pOCO.RoleId   = pC.RoleId;
                pOCO.RoleName = pC.RoleName;
                //pOCO.CreatedBy = pC.CreatedBy;
                //pOCO.ModifiedBy = pC.ModifiedBy;

                pList.Add(pOCO);
            }

            var data = pList;

            return(Json(new { draw = draw, recordsFiltered = totalrecords, recordsTotal = totalrecords, data = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public JsonResult GetRoleByGroupId(int GroupId)
        {
            RoleMasterBL   bL       = new RoleMasterBL();
            RoleMasterPOCO pOCOList = new RoleMasterPOCO();

            pOCOList = bL.GetRoleByGroupId(GroupId);

            RoleMasterPOCO dept = new RoleMasterPOCO();

            dept.RoleId   = pOCOList.RoleId;
            dept.RoleName = pOCOList.RoleName;

            var data = dept;

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public int SaveUpdateRoleMaster(RoleMasterPOCO pOCO)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCCMSDBConnectionString"].ConnectionString);

            con.Open();
            SqlCommand cmd = new SqlCommand("stpSaveUpdateRoleMaster", con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@RoleName", pOCO.RoleName.ToString());

            //cmd.Parameters.AddWithValue("@IsActive", crew.IsActive);

            if (!String.IsNullOrEmpty(pOCO.CreatedBy))
            {
                cmd.Parameters.AddWithValue("@CreatedBy", pOCO.CreatedBy.ToString());
            }
            else
            {
                cmd.Parameters.AddWithValue("@CreatedBy", DBNull.Value);
            }

            if (!String.IsNullOrEmpty(pOCO.ModifiedBy))
            {
                cmd.Parameters.AddWithValue("@ModifiedBy", pOCO.ModifiedBy.ToString());
            }
            else
            {
                cmd.Parameters.AddWithValue("@ModifiedBy", DBNull.Value);
            }


            if (pOCO.RoleId > 0)
            {
                cmd.Parameters.AddWithValue("@RoleId", pOCO.RoleId);
            }
            else
            {
                cmd.Parameters.AddWithValue("@RoleId", DBNull.Value);
            }

            int recordsAffected = cmd.ExecuteNonQuery();

            con.Close();

            return(recordsAffected);
        }
Exemplo n.º 7
0
        public JsonResult GetRoleMasterByRoleId(int RoleId)
        {
            RoleMasterBL   bL       = new RoleMasterBL();
            RoleMasterPOCO pOCOList = new RoleMasterPOCO();

            pOCOList = bL.GetRoleMasterByRoleId(RoleId);

            RoleMasterPOCO dept = new RoleMasterPOCO();

            dept.RoleId   = pOCOList.RoleId;
            dept.RoleName = pOCOList.RoleName;
            //dept.CreatedBy = pOCOList.CreatedBy;
            //dept.ModifiedBy = pOCOList.ModifiedBy;

            var data = dept;

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 8
0
        public RoleMasterPOCO GetRoleByGroupId(int GroupId)
        {
            RoleMasterPOCO        roleMasterPOCO  = new RoleMasterPOCO();
            List <RoleMasterPOCO> roleMasterPOCOs = new List <RoleMasterPOCO>();
            DataSet ds = new DataSet();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCCMSDBConnectionString"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("stpGetRoleNameByGroupId", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@GroupId", GroupId);
                    con.Open();

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(ds);
                    con.Close();
                }
            }
            return(ConvertDataTableToRole(ds).FirstOrDefault());
        }
Exemplo n.º 9
0
        public RoleMasterPOCO GetRoleMasterByRoleId(int RoleId)
        {
            RoleMasterPOCO prodPOList = new RoleMasterPOCO();
            RoleMasterPOCO prodPO     = new RoleMasterPOCO();
            DataSet        ds         = new DataSet();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCCMSDBConnectionString"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("stpGetRoleMasterByRoleId", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@RoleId", RoleId);
                    con.Open();

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(ds);
                    con.Close();
                }
            }
            return(ConvertDataTableToRoleMasterByRoleIdList(ds));
        }
Exemplo n.º 10
0
        public int SaveUpdateRoleMaster(RoleMasterPOCO pOCO /*,int VesselID*/)
        {
            RoleMasterDAL dAL = new RoleMasterDAL();

            return(dAL.SaveUpdateRoleMaster(pOCO /*, VesselID*/));
        }