public ActionResult _Destroy([DataSourceRequest]DataSourceRequest request, TB_TransferExt model)
        {
            string Msg = "";
            try
            {
                TB_TransferRepository modelRepo = new TB_TransferRepository();
                if (modelRepo.Delete(model, ref Msg, this) == false)
                {
                    return this.Json(new DataSourceResult { Errors = Msg });
                }
            }
            catch (Exception ex)
            {
                string hostName1 = Dns.GetHostName();
                string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                string PageName = Convert.ToString(Session["PageName"]);
                //string GetUserIPAddress = GetUserIPAddress1();
                using (BaseRepository baseRepo = new BaseRepository())
                {
                    //BizContext BizContext1 = new BizContext();
                    BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                }
                Session["PageName"] = "";
                string error = ErrorHandling.HandleException(ex);
                return this.Json(new DataSourceResult { Errors = error });
            }

            return Json(request);
        }
 public bool Update(TB_TransferExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     using (DBEntities DE = new DBEntities())
     {
         var DepObj = DE.TB_Transfer.Where(x => x.ID == model.ID).FirstOrDefault();
         DepObj.BusinessPartnerID = model.BusinessPartnerID;
         DepObj.CostCurrencyID = model.CostCurrencyID;
         DepObj.CurrencyID = model.CurrencyID;
         DepObj.TransferPaxID = model.TransferPaxID;
         DepObj.DepartureRegionID = model.DepartureRegionID;
         DepObj.DepositCurrencyID = model.DepositCurrencyID;
         DepObj.TransferPeriodID = model.TransferPeriodID;
         DepObj.Deposit = model.Deposit;
         DepObj.Amount = model.Amount;
         DepObj.Cost = model.Amount;
         DepObj.HitCount = model.HitCount;
         DepObj.Active = model.Active;
         DepObj.OpDateTime = DateTime.Now;
         DepObj.OpUserID = 0;
         DE.SaveChanges();
     }
     return status;
 }
 public bool Delete(TB_TransferExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     using (DBEntities DE = new DBEntities())
     {
         var DepObj = DE.TB_Transfer.Where(x => x.ID == model.ID).FirstOrDefault();
         DE.TB_Transfer.Remove(DepObj);
         DE.SaveChanges();
     }
     return status;
 }
        public List<TB_TransferExt> GetAllTableValue(int TableID)
        {
            List<TB_TransferExt> list = new List<TB_TransferExt>();

            DataTable dt = new DataTable();
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("B_DisplayTable_BizTbl_Table_Sp", SQLCon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TableID", TableID);
            cmd.Parameters.AddWithValue("@CultureCode", CultureCode);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);
            SQLCon.Close();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    TB_TransferExt model = new TB_TransferExt();
                    model.ID = Convert.ToInt32(dr["ID"]);
                    model.BusinessPartnerID = Convert.ToInt32(dr["BusinessPartnerID"]);
                    model.BusinessPartnerName = dr["FK_BusinessPartnerID_ID"].ToString();
                    model.TransferPeriodName = dr["FK_TransferPeriodID_ID"].ToString();
                    model.TransferPeriodID = Convert.ToInt32(dr["TransferPeriodID"]);
                    model.TransferPaxID = Convert.ToInt32(dr["TransferPaxID"]);
                    model.TransferPaxName = dr["FK_TransferPaxID_ID"].ToString();
                    model.DepartureRegionID = Convert.ToInt64(dr["DepartureRegionID"]);
                    model.DepartureRegionName = dr["FK_DepartureRegionID_ID"].ToString();
                    model.DestinationRegionID = Convert.ToInt64(dr["DestinationRegionID"]);
                    model.DestinationRegionName = dr["FK_DestinationRegionID_ID"].ToString();
                    model.Amount = Convert.ToDecimal(dr["Amount"]);
                    model.Cost = Convert.ToDecimal(dr["Cost"]);
                    model.Deposit = Convert.ToDecimal(dr["Deposit"]);
                    model.CurrencyID = Convert.ToInt32(dr["CurrencyID"]);
                    model.Currency = dr["FK_CurrencyID_ID"].ToString();
                    model.CostCurrencyID = Convert.ToInt32(dr["CostCurrencyID"]);
                    model.CostCurrencyName = dr["FK_CostCurrencyID_ID"].ToString();
                    model.DepositCurrencyID = Convert.ToInt32(dr["DepositCurrencyID"]);
                    model.DepositCurrencyName = dr["FK_DepositCurrencyID_ID"].ToString();
                    model.HitCount = Convert.ToInt64(dr["HitCount"]);
                    model.Active = Convert.ToBoolean(dr["Active"]);
                    list.Add(model);
                }
            }

            return list;
        }
 public bool Create(TB_TransferExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     DBEntities insertentity = new DBEntities();
     TB_Transfer DepObj = new TB_Transfer();
     //DepObj.ID = model.ID;
     DepObj.BusinessPartnerID = model.BusinessPartnerID;
     DepObj.CostCurrencyID = model.CostCurrencyID;
     DepObj.CurrencyID = model.CurrencyID;
     DepObj.TransferPaxID = model.TransferPaxID;
     DepObj.DepartureRegionID = model.DepartureRegionID;
     DepObj.DepositCurrencyID = model.DepositCurrencyID;
     DepObj.TransferPeriodID = model.TransferPeriodID;
     DepObj.Deposit = model.Deposit;
     DepObj.Amount = model.Amount;
     DepObj.Cost = model.Amount;
     DepObj.HitCount = model.HitCount;
     DepObj.Active = model.Active;
     DepObj.OpDateTime = DateTime.Now;
     DepObj.CreateDateTime = DateTime.Now;
     DepObj.OpUserID = 0;
     DepObj.CreateUserID = 0;
     insertentity.TB_Transfer.Add(DepObj);
     insertentity.SaveChanges();
     int id = DepObj.ID;
     return status;
 }