Exemplo n.º 1
0
        public static clsPastPresidentsOutput GetPastPresidentsList(clsPastPresidentsInput inputParam)
        {
            try
            {
                MySqlParameter[] param = new MySqlParameter[3];
                param[0] = new MySqlParameter("?GroupId", inputParam.GroupId);
                param[1] = new MySqlParameter("?SearchText", string.IsNullOrEmpty(inputParam.SearchText) ? "" : inputParam.SearchText.Replace(" ", "%").Trim());
                param[2] = new MySqlParameter("?updateOn", inputParam.updateOn);

                DataSet ds = MySqlHelper.ExecuteDataset(GlobalVar.strAppConn, CommandType.StoredProcedure, "V1_USPGetPastPresidentsList", param);

                DataTable dtNewRecords      = ds.Tables[0];
                DataTable dtUpdatedRecords  = ds.Tables[1];
                string    strDeletedRecords = ds.Tables[2].Rows[0]["PastPresidentId"].ToString();

                List <clsPastPresident> newRecords = new List <clsPastPresident>();
                newRecords = GlobalFuns.DataTableToList <clsPastPresident>(dtNewRecords);
                foreach (clsPastPresident objPP in newRecords)
                {
                    if (!string.IsNullOrEmpty(objPP.PhotoPath))
                    {
                        objPP.PhotoPath = ConfigurationManager.AppSettings["imgPath"] + "Documents/pastpresidents/Group" + inputParam.GroupId + "/" + objPP.PhotoPath;
                    }
                }

                List <clsPastPresident> updatedRecords = new List <clsPastPresident>();
                updatedRecords = GlobalFuns.DataTableToList <clsPastPresident>(dtUpdatedRecords);
                foreach (clsPastPresident objPP in updatedRecords)
                {
                    if (!string.IsNullOrEmpty(objPP.PhotoPath))
                    {
                        objPP.PhotoPath = ConfigurationManager.AppSettings["imgPath"] + "Documents/pastpresidents/Group" + inputParam.GroupId + "/" + objPP.PhotoPath;
                    }
                }

                clsPastPresidentsOutput obj = new clsPastPresidentsOutput();

                obj.newRecords     = newRecords;
                obj.updatedRecords = updatedRecords;
                obj.deletedRecords = strDeletedRecords;

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public object getPastPresidentsList(clsPastPresidentsInput inputParam)
        {
            dynamic TBPastPresidentListResult;

            try
            {
                clsPastPresidentsOutput result = PastPresidents.GetPastPresidentsList(inputParam);

                if (result != null)
                {
                    TBPastPresidentListResult = new { status = "0", message = "success", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), TBPastPresidentList = result };
                }
                else
                {
                    TBPastPresidentListResult = new { status = "0", message = "success" };
                }
            }
            catch
            {
                TBPastPresidentListResult = new { status = "1", message = "failed" };
            }

            return(new { TBPastPresidentListResult });
        }