private GroupMasterPOCO ConvertDataTableToGroupMasterByGroupIdList(DataSet ds) { GroupMasterPOCO pPOCOPC = new GroupMasterPOCO(); //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["GroupId"] != null) { pPOCOPC.GroupId = Convert.ToInt32(item["GroupId"].ToString()); } if (item["GroupName"] != System.DBNull.Value) { pPOCOPC.GroupName = item["GroupName"].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); }
public JsonResult SaveUpdateGroupMaster(GroupMasterPOCO pOCO) { GroupMasterBL bL = new GroupMasterBL(); GroupMasterPOCO pC = new GroupMasterPOCO(); pC.GroupId = pOCO.GroupId; pC.GroupName = pOCO.GroupName; pC.CreatedBy = pOCO.CreatedBy; pC.ModifiedBy = pOCO.ModifiedBy; return(Json(bL.SaveUpdateGroupMaster(pC /*, int.Parse(Session["VesselID"].ToString())*/), JsonRequestBehavior.AllowGet)); }
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; } GroupMasterBL bL = new GroupMasterBL(); /////////////////////////////////////////////////////////////////////////// int totalrecords = 0; List <GroupMasterPOCO> pocoList = new List <GroupMasterPOCO>(); pocoList = bL.GetAllGroupMasterPageWise(pageIndex, ref totalrecords, length /*, int.Parse(Session["VesselID"].ToString())*/); List <GroupMasterPOCO> pList = new List <GroupMasterPOCO>(); foreach (GroupMasterPOCO pC in pocoList) { GroupMasterPOCO pOCO = new GroupMasterPOCO(); pOCO.GroupId = pC.GroupId; pOCO.GroupName = pC.GroupName; //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)); }
public int SaveUpdateGroupMaster(GroupMasterPOCO groupMaster) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCCMSDBConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("stpSaveUpdateGroupMaster", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@GroupName", groupMaster.GroupName.ToString()); //cmd.Parameters.AddWithValue("@IsActive", crew.IsActive); if (!String.IsNullOrEmpty(groupMaster.CreatedBy)) { cmd.Parameters.AddWithValue("@CreatedBy", groupMaster.CreatedBy.ToString()); } else { cmd.Parameters.AddWithValue("@CreatedBy", DBNull.Value); } if (!String.IsNullOrEmpty(groupMaster.ModifiedBy)) { cmd.Parameters.AddWithValue("@ModifiedBy", groupMaster.ModifiedBy.ToString()); } else { cmd.Parameters.AddWithValue("@ModifiedBy", DBNull.Value); } if (groupMaster.GroupId > 0) { cmd.Parameters.AddWithValue("@GroupId", groupMaster.GroupId); } else { cmd.Parameters.AddWithValue("@GroupId", DBNull.Value); } int recordsAffected = cmd.ExecuteNonQuery(); con.Close(); return(recordsAffected); }
public JsonResult GetGroupMasterByGroupId(int GroupId) { GroupMasterBL bL = new GroupMasterBL(); GroupMasterPOCO pOCOList = new GroupMasterPOCO(); pOCOList = bL.GetGroupMasterByGroupId(GroupId); GroupMasterPOCO dept = new GroupMasterPOCO(); dept.GroupId = pOCOList.GroupId; dept.GroupName = pOCOList.GroupName; //dept.CreatedBy = pOCOList.CreatedBy; //dept.ModifiedBy = pOCOList.ModifiedBy; var data = dept; return(Json(data, JsonRequestBehavior.AllowGet)); }
public GroupMasterPOCO GetGroupMasterByGroupId(int GroupId) { GroupMasterPOCO prodPOList = new GroupMasterPOCO(); GroupMasterPOCO prodPO = new GroupMasterPOCO(); DataSet ds = new DataSet(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TCCCMSDBConnectionString"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("stpGetGroupMasterByGroupId", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@GroupId", GroupId); con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); } } return(ConvertDataTableToGroupMasterByGroupIdList(ds)); }
private List <GroupMasterPOCO> ConvertDataTableToGetAllGroupMasterList(DataSet ds) { List <GroupMasterPOCO> crewtimesheetList = new List <GroupMasterPOCO>(); //check if there is at all any data if (ds.Tables.Count > 0) { foreach (DataRow item in ds.Tables[0].Rows) { GroupMasterPOCO groupMasterPOCO = new GroupMasterPOCO(); //if (item["GroupId"] != System.DBNull.Value) // groupMasterPOCO.GroupId = Convert.ToInt32(item["GroupId"].ToString()); if (item["GroupName"] != System.DBNull.Value) { groupMasterPOCO.GroupName = item["GroupName"].ToString(); } if (item["CreatedBy"] != System.DBNull.Value) { groupMasterPOCO.CreatedBy = item["CreatedBy"].ToString(); } if (item["ModifiedBy"] != System.DBNull.Value) { groupMasterPOCO.ModifiedBy = item["ModifiedBy"].ToString(); } if (item["GroupId"] != System.DBNull.Value) { groupMasterPOCO.GroupId = Convert.ToInt16(item["GroupId"]); } crewtimesheetList.Add(groupMasterPOCO); } } return(crewtimesheetList); }
public int SaveUpdateGroupMaster(GroupMasterPOCO groupMaster /*,int VesselID*/) { GroupMasterDAL dAL = new GroupMasterDAL(); return(dAL.SaveUpdateGroupMaster(groupMaster /*, VesselID*/)); }