コード例 #1
0
        public async Task <IActionResult> PutCountryMaster(int id, CountryMaster countryMaster)
        {
            if (id != countryMaster.CountryId)
            {
                return(BadRequest());
            }

            _context.Entry(countryMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CountryMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public ActionResult Create(CountryMasterVM c)
        {
            CountryMaster obj = new CountryMaster();
            int           max = (from a in db.CountryMasters orderby a.CountryID descending select a.CountryID).FirstOrDefault();

            if (max == null)
            {
                obj.CountryID   = 1;
                obj.CountryName = c.CountryName;
                obj.CountryCode = c.CountryCode;
                obj.IATACode    = c.IATACode;
            }
            else
            {
                obj.CountryID   = max + 1;
                obj.CountryName = c.CountryName;
                obj.CountryCode = c.CountryCode;
                obj.IATACode    = c.IATACode;
            }
            db.CountryMasters.Add(obj);
            db.SaveChanges();
            TempData["SuccessMsg"] = "You have successfully added Country.";

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <ActionResult <CountryMaster> > PostCountryMaster(CountryMaster countryMaster)
        {
            _context.Country.Add(countryMaster);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCountryMaster", new { id = countryMaster.CountryId }, countryMaster));
        }
コード例 #4
0
ファイル: Security.cs プロジェクト: huangss0/GTS0
        internal void Init_from_DRWIN_sec(Models.Securities.Security dr_sec)
        {
            if (dr_sec == null)
            {
                return;
            }

            this.security_name.Value = dr_sec.Name.Value;
            this.cusip.Value         = dr_sec.CUSIP.Value;
            this.isin.Value          = dr_sec.ISIN.Value;
            this.sedol.Value         = dr_sec.Sedol.Value;

            Country cty = CountryMaster.GetCountry_name(dr_sec.Country.Value);

            if (cty != null)
            {
                ESPsys esys = ESPsys_master.Get_ESPsys_coi(cty.cntry_cd.Value);
                if (esys != null)
                {
                    this.esp_system_id.Value = esys.esp_system_id;
                }
                else
                {
                    this.esp_system_id.Value = 11; // 11 is for italy
                }
            }
        }
コード例 #5
0
        public async Task <IHttpActionResult> PutCountryMaster(int id, CountryMaster countryMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != countryMaster.Id)
            {
                return(BadRequest());
            }

            db.Entry(countryMaster).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CountryMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
        public async Task AddCountryMaster(CountryMaster prodData)
        {
            var maxId = await WithConnection(async c =>
            {
                return(await c.QueryAsync <int>("SELECT max(CountryIndex) FROM CountryMaster"));
            });

            //Setting Primary Key
            if (maxId.SingleOrDefault() == 0)
            {
                prodData.CountryIndex = 1;
            }
            else
            {
                prodData.CountryIndex = maxId.SingleOrDefault() + 1;
            }

            //Filling Other Records like User Id, Creation & Update Date
            prodData.CreateUserIndex = 1; //Later Logged in User
            prodData.UpdateUserIndex = 1; //Later Logged in User
            prodData.CreateDateTime  = DateTime.Now;
            prodData.UpdateDateTime  = DateTime.Now;

            await WithConnection(async c =>
            {
                return(await c.QueryAsync <int>(SQLConstants.InsertCountryMaster, prodData));
            });
        }
コード例 #7
0
        public int Save(CountryMaster country, string CRUDAction, out string ErrorCode)
        {
            int result = 0;

            ErrorCode = "-1";
            using (SqlCommand objcmd = new SqlCommand())
            {
                try
                {
                    objcmd.CommandType = CommandType.StoredProcedure;
                    objcmd.CommandText = "STP_InsertUpdateCountryMaster";
                    objcmd.Parameters.Add(new SqlParameter("@CountryID", country.CountryID)).Direction = ParameterDirection.InputOutput;
                    objcmd.Parameters.Add(new SqlParameter("@CountryName", country.CountryName));
                    objcmd.Parameters.Add(new SqlParameter("@Status", country.Status));
                    objcmd.Parameters.Add(new SqlParameter("@remark", country.Remark));
                    objcmd.Parameters.Add(new SqlParameter("@CreatedBy", country.CreatedBy));
                    objcmd.Parameters.Add(new SqlParameter("@ModifiedBy", country.ModifiedBy));
                    objcmd.Parameters.Add(new SqlParameter("@CRUDAction", CRUDAction));
                    objcmd.Parameters.Add(new SqlParameter("@ErrorCode", SqlDbType.VarChar, 20)).Direction = ParameterDirection.Output;
                    result            = DBconnection.ExecuteNonQuery(objcmd);
                    country.CountryID = Convert.ToInt64("0" + objcmd.Parameters["@CountryID"].Value);
                    ErrorCode         = Convert.ToString(objcmd.Parameters["@ErrorCode"].Value);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    objcmd.Dispose();
                }
            }
            return(result);
        }
コード例 #8
0
        public IActionResult Index(CountryMaster CountryMaster)
        {
            //-- validation -------//
            if (CountryMaster.ID == 0)
            {
                ModelState.AddModelError("", "Select Country");
            }


            //---- Getting Selected Value
            int SelectedValue = CountryMaster.ID;

            ViewBag.SelectedValue = CountryMaster.ID;

            //--- Setting Data back to ViewBag after Posting Form ---

            List <CountryMaster> countryList = new List <Models.CountryMaster>();

            countryList = (from product in _context.CountryMaster
                           select product).ToList();

            countryList.Insert(0, new CountryMaster {
                ID = 0, Name = "Select"
            });
            ViewBag.ListofCountry = countryList;

            return(View());
        }
コード例 #9
0
        /// <summary>
        /// Extract information from [Security]
        /// </summary>
        private void XBRL_from_Security(Security sec)
        {
            if (sec == null)
            {
                return;
            }

            this.Issue.Value        = sec.Name.Value;
            this.CUSIP.Value        = sec.CUSIP.Value;
            this.ISIN.Value         = sec.ISIN.Value;
            this.TickerSymbol.Value = sec.TickerSymbol.Value;
            this.SEDOL.Value        = sec.Sedol.Value;

            this.Country.Value = sec.Country.Value;
            Country cty = CountryMaster.GetCountry_name(sec.Country.Value);

            if (cty != null)
            {
                this.ISO2CntryCode.Value = cty.cntry_cd.Value;
            }

            this.Depositary.Value = sec.Depositary.Value;
            this.Sponsored.Value  = !sec.Depositary.Value.Equals(Depositaries.Depositary.Unsponsored, StringComparison.OrdinalIgnoreCase);
            this.FirstFiler.Value = sec.FirstFiler.Value;

            this.ADR_Ratio_ADR.Value = sec.ADR_RATIO_ADR.Value;
            this.ADR_Ratio_ORD.Value = sec.ADR_RATIO_ORD.Value;
        }
コード例 #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            CountryMaster countryMaster = db.CountryMasters.Find(id);

            db.CountryMasters.Remove(countryMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #11
0
        public JsonResult Get([FromBody] CountryMaster m)
        {
            var response = _context.Add(m);

            _context.SaveChanges();

            return(Json(new { sucess = true, result = "countryname" }));
        }
コード例 #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            CountryMaster countrymaster = db.CountryMasters.Find(id);

            db.CountryMasters.Remove(countrymaster);
            db.SaveChanges();
            TempData["SuccessMsg"] = "You have successfully Deleted Country.";
            return(RedirectToAction("Index"));
        }
コード例 #13
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CountryMaster countryMaster = await db.CountryMasters.FindAsync(id);

            db.CountryMasters.Remove(countryMaster);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #14
0
 public ActionResult Edit(CountryMaster countrymaster)
 {
     if (ModelState.IsValid)
     {
         objSourceMastersModel.SaveCountryById(countrymaster);
         ViewBag.SuccessMsg = "You have successfully updated Country.";
         return(View("Index", objSourceMastersModel.GetCountry()));
     }
     return(View(countrymaster));
 }
コード例 #15
0
        //
        // GET: /Country/Details/5

        public ActionResult Details(int id = 0)
        {
            CountryMaster country = objSourceMastersModel.GetCountryById(id);

            if (country == null)
            {
                return(HttpNotFound());
            }
            return(View(country));
        }
コード例 #16
0
        //
        // GET: /CountryMaster/Details/5

        public ActionResult Details(int id = 0)
        {
            CountryMaster countrymaster = db.CountryMasters.Find(id);

            if (countrymaster == null)
            {
                return(HttpNotFound());
            }
            return(View(countrymaster));
        }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "CountryId,CountryName")] CountryMaster countryMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(countryMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(countryMaster));
 }
コード例 #18
0
        public async Task <IHttpActionResult> Create(CountryMaster prodData)
        {
            if (prodData != null)
            {
                await CountryMasterDA.AddCountryMaster(prodData);

                return(Ok());
            }
            return(BadRequest("Request cannot be NULL"));
        }
コード例 #19
0
        public static void Save(CountryMaster countryMaster)
        {
            if (countryMaster.CountryID == 0)
            {
                //secModule.CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                DbContextHelper.DbContext.Add(countryMaster);
            }

            DbContextHelper.DbContext.SaveChanges();
        }
コード例 #20
0
        private void Init_countries()
        {
            List <Country> list = CountryMaster.GetAll_countryList();

            foreach (Country cty in list)
            {
                this.cty_itemID_dic[cty.name] = this.cty_checkedListBox.Items.Count;
                this.cty_checkedListBox.Items.Add(cty.name);
            }
        }
コード例 #21
0
        public async Task <ActionResult> Edit([Bind(Include = "ID,Name")] CountryMaster countryMaster)
        {
            if (ModelState.IsValid)
            {
                db.Entry(countryMaster).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(countryMaster));
        }
コード例 #22
0
        public ActionResult Create([Bind(Include = "CountryId,CountryName")] CountryMaster countryMaster)
        {
            if (ModelState.IsValid)
            {
                db.CountryMasters.Add(countryMaster);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(countryMaster));
        }
コード例 #23
0
        public async Task <IHttpActionResult> GetCountryMaster(int id)
        {
            CountryMaster countryMaster = await db.Countries.FindAsync(id);

            if (countryMaster == null)
            {
                return(NotFound());
            }

            return(Ok(countryMaster));
        }
コード例 #24
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["admin"] == null)
            {
                return(RedirectToAction("Index", "adminLogin"));
            }
            CountryMaster countryMaster = db.CountryMasters.Find(id);

            db.CountryMasters.Remove(countryMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #25
0
        public List <CountryMaster> Get(QueryBO objQuery)
        {
            SqlDataReader        reader     = null;
            SqlConnection        con        = null;
            List <CountryMaster> lstCountry = null;
            SqlCommand           objcmd     = null;
            CountryMaster        objCountry = null;

            try
            {
                lstCountry = new List <CountryMaster>();
                using (con = DBconnection.ConnectToDB())
                {
                    objcmd             = new SqlCommand();
                    objcmd.Connection  = con;
                    objcmd.CommandType = CommandType.StoredProcedure;
                    objcmd.CommandText = "STP_SelectCountryMaster";
                    objcmd.Parameters.Add(new SqlParameter("@PageNumber", objQuery.PageNumber));
                    objcmd.Parameters.Add(new SqlParameter("@PageSize", objQuery.PageSize));
                    objcmd.Parameters.Add(new SqlParameter("@Filter", objQuery.Filter));
                    objcmd.Parameters.Add(new SqlParameter("@Sort", objQuery.Sort));
                    objcmd.Parameters.Add(new SqlParameter("@TotalRecords", SqlDbType.Int)).Direction = ParameterDirection.Output;
                    reader = objcmd.ExecuteReader();
                    if (reader != null && reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            objCountry = new CountryMaster();

                            objCountry.CountryID   = Convert.ToInt64(reader["CountryID"]);
                            objCountry.CountryName = Convert.ToString("" + reader["CountryName"]);
                            objCountry.Status      = Convert.ToInt16("" + reader["Status"]);
                            objCountry.strStatus   = Convert.ToString("" + reader["strStatus"]);
                            objCountry.Remark      = Convert.ToString("" + reader["Remark"]);
                            objCountry.strStatus   = Convert.ToString("" + reader["strStatus"]);
                            lstCountry.Add(objCountry);
                        }
                    }
                }
                objQuery.TotalRecords = Convert.ToInt32(objcmd.Parameters["@TotalRecords"].Value);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Dispose();
                objcmd = null;
                con    = null;
            }
            return(lstCountry);
        }
コード例 #26
0
        public async Task <IActionResult> PostCountry([FromBody] CountryMaster obj)
        {
            if (!ModelState.IsValid)
            {
                return(Ok(ModelState.ResponseValidation()));
            }

            obj.IsActive = true;
            await _iCountryRepository.Insert(obj);

            return(Ok(APIResponse.SetResponse(APIResponseStatus.Ok, "Country save successfully.", APIOpStatus.Success, obj)));
        }
コード例 #27
0
        static void Main(string[] args)
        {
            CountryMaster obj1 = new CountryMaster();

            obj1.Insert();
            CustomerClass obj2 = new CustomerClass();

            obj2.Insert();
            Console.WriteLine(CommonRoutine.count.ToString());

            Console.ReadLine();
        }
コード例 #28
0
        public async Task <ActionResult> Create([Bind(Include = "ID,Name")] CountryMaster countryMaster)
        {
            if (ModelState.IsValid)
            {
                db.CountryMasters.Add(countryMaster);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(countryMaster));
        }
コード例 #29
0
 public async Task Update(CountryMaster countryMaster)
 {
     try
     {
         _context.Entry(countryMaster).State = EntityState.Modified;
         await _context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #30
0
        public async Task <IHttpActionResult> PostCountryMaster(CountryMaster countryMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Countries.Add(countryMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = countryMaster.Id }, countryMaster));
        }