示例#1
0
        public JsonResult Select_CostofLiving(CostofLiving obj)
        {
            List <CostofLiving> _list = new List <CostofLiving>();

            obj.InstituteID = Session["InstituteID"].ToString();
            CostofLivingRepository _objRepository = new CostofLivingRepository();
            DataSet ds = _objRepository.select_tbl_CostofLiving(obj);

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        CostofLiving _objList = new CostofLiving();
                        _objList.ID                       = row["ID"].ToString();
                        _objList.InstituteID              = row["InstituteID"].ToString();
                        _objList.Natureofcostcategory_id  = row["Natureofcostcategory_id"].ToString();
                        _objList.ApproximatCost           = row["ApproximatCost"].ToString();
                        _objList.ApproximatCostType       = row["ApproximatCostType"].ToString();
                        _objList.UploadedFilePath         = row["UploadedFilePath"].ToString();
                        _objList.Natureofcostcategoryname = row["Natureofcostcategoryname"].ToString();
                        _list.Add(_objList);
                    }
                }
            }
            return(Json(new
            {
                List = _list
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
示例#2
0
        public JsonResult Delete_CostofLiving(CostofLiving _obj)
        {
            CostofLivingRepository objRep = new CostofLivingRepository();

            _obj.InstituteID = Session["InstituteID"].ToString();
            _obj.Type        = "Delete";
            DataSet _ds  = objRep.delete_tbl_CostofLiving(_obj);
            bool    flag = true;

            if (_ds != null)
            {
                if (_ds.Tables[0].Rows.Count > 0)
                {
                    if (_ds.Tables[0].Rows[0]["FLAG"].ToString() == "0")
                    {
                        flag = false;
                    }
                }
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
示例#3
0
 public DataSet insertupdate_CostofLiving(CostofLiving _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("sp_insert_update_tbl_CostofLiving", _cn);
         _cmd.Parameters.AddWithValue("@ID", _obj.ID);
         _cmd.Parameters.AddWithValue("@InstituteID", _obj.InstituteID);
         _cmd.Parameters.AddWithValue("@Natureofcostcategory_id", _obj.Natureofcostcategory_id);
         _cmd.Parameters.AddWithValue("@ApproximatCost", _obj.ApproximatCost);
         _cmd.Parameters.AddWithValue("@ApproximatCostType", _obj.ApproximatCostType);
         _cmd.Parameters.AddWithValue("@UploadedFilePath", _obj.UploadedFilePath);
         _cmd.Parameters.AddWithValue("@CreatedBy", _obj.CreatedBy);
         _cmd.Parameters.AddWithValue("@CreatedIP", _obj.CreatedIP);
         _cmd.Parameters.AddWithValue("@Edited_by", _obj.Edited_by);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
示例#4
0
 public DataSet delete_tbl_CostofLiving(CostofLiving _obj)
 {
     try
     {
         _cn.Open();
         SqlCommand _cmd = new SqlCommand("sp_delete_tbl_CostofLiving", _cn);
         _cmd.Parameters.AddWithValue("@ID", _obj.ID);
         _cmd.Parameters.AddWithValue("@InstituteID", _obj.InstituteID);
         _cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter _adp = new SqlDataAdapter(_cmd);
         DataSet        _ds  = new DataSet();
         _adp.Fill(_ds);
         _adp.Dispose();
         _cmd.Dispose();
         return(_ds);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         _cn.Close();
     }
 }
示例#5
0
        public JsonResult Save_CostofLiving(CostofLiving _obj)
        {
            bool flag = false;

            try
            {
                CostofLivingRepository _objRepository = new CostofLivingRepository();
                _obj.InstituteID = Session["InstituteID"].ToString();
                //_obj.UploadedFilePath = Session["UploadedFilePath"].ToString();
                _obj.CreatedBy = Session["InstituteID"].ToString();
                _obj.CreatedIP = Session["localIP"].ToString();
                _obj.Edited_by = Session["User_id"].ToString();
                DataSet _ds = _objRepository.insertupdate_CostofLiving(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        if (_ds.Tables[0].Rows[0]["FLAG"].ToString() == "1")
                        {
                            flag = true;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.Print(ex.Message);
                throw;
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }