public ResultModel Update(UnitMasterModel obj) { ResultModel oOutput = new ResultModel(); try { UnitMaster oUnitMaster = dbSet.Where(m => m.ID == obj.ID).FirstOrDefault(); if (oUnitMaster == null) { oOutput.Status = 0; oOutput.Msg = "Record not exist"; } else { // Removing Already Added Mapper.Map(obj, oUnitMaster); oDB.SaveChanges(); oOutput.Data = Mapper.Map <UnitMasterModel>(oUnitMaster); } } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public ActionResult DeletePartial(UnitMaster untmastr) { untmastr.status = "InActive"; untmastr.modifiedOn = DateTime.Now; _unitservice.updateunit(untmastr); return(RedirectToAction("ShowUnit/" + untmastr.UnitId, "Unit")); }
public UnitMaster GetUnitMasterDetails(String ID) { UnitMaster obj = null; string commandText = OleDBHelper.GetQueryText("UnitMaster_SelectID", QueryType.Procedures); OleDbParameter[] parameters = new OleDbParameter[] { new OleDbParameter("@ID", ID) }; using (DataTable table = OleDBHelper.ExecuteParamerizedSelectCommand(commandText, CommandType.Text, parameters)) { //check if any record exist or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of employees obj = new UnitMaster(); obj.ID = Convert.ToString(table.Rows[0]["ID"]); obj.UnitName = Convert.ToString(table.Rows[0]["UnitName"]); } } return(obj); }
public List <UnitMaster> GetUnitMasterList() { List <UnitMaster> list = null; string commandText = OleDBHelper.GetQueryText("UnitMaster_SelectAll", QueryType.Views); using (DataTable table = OleDBHelper.ExecuteSelectCommand(commandText, CommandType.Text)) { //check if any record exist or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of employees list = new List <UnitMaster>(); //Now lets populate the employee details into the list of employees foreach (DataRow row in table.Rows) { UnitMaster obj = new UnitMaster(); obj.ID = Convert.ToString(row["ID"]); obj.UnitName = Convert.ToString(row["UnitName"]); list.Add(obj); } } } return(list); }
public ActionResult Create([ModelBinder(typeof(UnitCustomBinder))] UnitMaster unitmaster) { MainApplication model = new MainApplication(); var details = _unitservice.getLastInserted(); int catVal = 0; int length = 0; if (details != null) { catVal = details.UnitId; catVal = catVal + 1; length = catVal.ToString().Length; } else { catVal = 1; length = 1; } string catCode = _utilityservice.getName("UNT", length, catVal); unitmaster.UnitCode = catCode; _unitservice.createunit(unitmaster); var id = _unitservice.getLastInserted().UnitId; var UnitId = Encode(id.ToString()); return(RedirectToAction("CreateDetails/" + UnitId, "Unit")); }
public ActionResult Create([Bind(Include = "UnitCode,UnitName,Address,Country,City,Pincode,Priority,PaySlip,IsActive,State")] UnitMaster unitMaster) { if (ModelState.IsValid) { bool isValid = db.UnitMasters.Any(x => x.UnitName == unitMaster.UnitName || x.Priority == unitMaster.Priority); if (!isValid) { unitMaster.IsActive = true; db.UnitMasters.Add(unitMaster); db.SaveChanges(); ViewBag.success = "Unit is Successfully created!"; ModelState.Clear(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View()); } else { ViewBag.error = "Sorry! Unitname is already exist!"; long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View(unitMaster)); } } ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View(unitMaster)); }
public APIResponse UpdateUnit(UnitMaster unitMaster) { APIResponse response = new APIResponse(); try { response.Data = unitManager.UpdateUnit(unitMaster); if (response.Data != 0) { response.Success = true; response.Error = null; } else { response.Success = false; response.Error = "Record not Updated"; } } catch (Exception ex) { response.Data = null; response.Success = false; response.Error = ex.Message; } return(response); }
private void SetObjectInfo(UnitMaster _objUnitMaster) { _objUnitMaster.UnitCode = txtUnitCode.Text; _objUnitMaster.UnitName = txtUnitName.Text; _objUnitMaster.CreatedBy = Session["LoginId"].ToString(); _objUnitMaster.ModifiedBy = Session["LoginId"].ToString(); }
public bool Delete(long id) { UnitMaster unitMaster = db.UnitMaster.Find(id); db.UnitMaster.Remove(unitMaster); db.SaveChanges(); return(true); }
public ActionResult DeleteConfirmed(long id) { UnitMaster unitMaster = db.UnitMasters.Find(id); db.UnitMasters.Remove(unitMaster); db.SaveChanges(); return(RedirectToAction("Index")); }
public UnitController(UnitMaster unitMaster, UnitConfig unitConfig, UnitData unitData) { this.unitMaster = unitMaster; this.unitConfig = unitConfig; this.unitData = unitData; Initialize(); }
private void AssignVariabltoControl(UnitMaster _objUnitMaster) { txtUnitCode.Text = _objUnitMaster.UnitCode; txtUnitName.Text = _objUnitMaster.UnitName; txtUnitCode.ReadOnly = true; txtUnitCode.Enabled = false; btnSave.Text = "Update"; }
public HttpResponseMessage GetUnits() { var units = new UnitMaster().Unit_GetAll(); if (units != null) { return(Request.CreateResponse(HttpStatusCode.OK, units)); } return(Request.CreateResponse(HttpStatusCode.NoContent, units)); }
public override string Execute(string original) { original = original.Replace("${Gs2::Weave::InventoryNamespaceName}", _installer.inventoryNamespaceName); original = original.Replace("${Gs2::Weave::InventoryModelName}", _installer.inventoryModelName); original = original.Replace("${Gs2::Weave::EnableDebugAcquireUnitAction}", _installer.enableDebugAcquireUnitAction.ToString()); if (_installer.enableDebugAcquireUnitAction) { original = original.Replace("${Gs2::Weave::IdentifierAcquireUnitPolicyName}", _installer.identifierAcquireUnitPolicyName); original = original.Replace("${Gs2::Weave::IdentifierAcquireUnitUserName}", _installer.identifierAcquireUnitUserName); } else { var json = JsonMapper.ToObject(original); json["Globals"]["Alias"].Remove("IdentifierAcquireUnitPolicyName"); json["Globals"]["Alias"].Remove("IdentifierAcquireUnitUserName"); json["Resources"].Remove("IdentifierAcquireUnitUser"); json["Resources"].Remove("IdentifierAcquireUnitPolicy"); json["Resources"].Remove("IdentifierAcquireUnitUserAttachPolicy"); json["Resources"].Remove("IdentifierAcquireUnitIdentifier"); json["Outputs"].Remove("IdentifierAcquireUnitPolicyName"); json["Outputs"].Remove("IdentifierAcquireUnitUserName"); json["Outputs"].Remove("IdentifierAcquireUnitClientId"); json["Outputs"].Remove("IdentifierAcquireUnitClientSecret"); original = json.ToJson(); } { var master = new UnitMaster { inventoryModels = new List <InventoryModel> { new InventoryModel { name = _installer.inventoryModelName, initialCapacity = _installer.capacity, maxCapacity = _installer.capacity, itemModels = _installer.units.Select( unit => unit.ToModel() ).ToList(), } } }; var stringBuilder = new StringBuilder(); var jsonWriter = new JsonWriter(stringBuilder); master.WriteJson(jsonWriter); var json = JsonMapper.ToObject(original); json["Resources"]["InventorySettings"]["Properties"]["Settings"] = stringBuilder.ToString(); original = json.ToJson(); } return(original); }
//Unit Binding private void BindUnit() { List<UnitMaster> u = dbcontext.UnitMasters.Where(x => x.Uid != 0).ToList(); UnitMaster unit = new UnitMaster { UnitName = "----Please select Unit", Uid = 0 }; u.Insert(0, unit); SelectList selectunit = new SelectList(u, "Uid", "UnitName", 0); ViewBag.selectedunit = selectunit; }
public async Task <IActionResult> UpSertUnitMaster(UnitMaster model) { if (model.Id > 0) { var responseUpdate = await _IUnitMasterService.Update(model); return(Json(ResponseHelper.GetResponseMessage(responseUpdate))); } var responseCreate = await _IUnitMasterService.CreateEntity(model); return(Json(ResponseHelper.GetResponseMessage(responseCreate))); }
public ActionResult Edit([Bind(Include = "UnitCode,UnitName,Address,Country,City,Pincode,Priority,PaySlip,IsActive,State")] UnitMaster unitMaster) { if (ModelState.IsValid) { bool isValid = db.UnitMasters.Any(x => (x.UnitCode != unitMaster.UnitCode) && (x.UnitName == unitMaster.UnitName || x.Priority == unitMaster.Priority)); if (!isValid) { db.Entry(unitMaster).State = EntityState.Modified; db.SaveChanges(); ViewBag.success = "Your Record Successfully Updated!"; long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View()); } else { if (db.UnitMasters.Any(x => (x.UnitCode != unitMaster.UnitCode) && (x.UnitName == unitMaster.UnitName))) { ViewBag.error = "Unitname is Already exist!"; long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View()); } else { ViewBag.error = "Priority is Already exist!"; long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View()); } } } long cid1 = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid1 = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid1), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid1), "CityName", "CityName"); return(View(unitMaster)); }
// GET: UnitMaster/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnitMaster unitMaster = db.UnitMasters.Find(id); if (unitMaster == null) { return(HttpNotFound()); } return(View(unitMaster)); }
public int UpdateUnit(UnitMaster unitMaster) { int result = 0; try { string query = string.Format("update UnitMaster set UnitName='{0}' where UnitId={1}", unitMaster.UnitName, unitMaster.UnitId); result = _db.Execute(query); } catch (Exception EX) { throw; } return(result); }
public UnitMaster SingleUnitMaster(int unitid) { UnitMaster unitMaster = new UnitMaster(); try { string query = string.Format("select * from UnitMaster where UnitId={0}", unitid); unitMaster = _db.Query <UnitMaster>(query).FirstOrDefault(); } catch (Exception) { throw; } return(unitMaster); }
public int InsertUnit(UnitMaster unitMaster) { int result = 0; try { string query = string.Format("insert into UnitMaster (UnitName) values ('{0}')", unitMaster.UnitName); result = _db.Execute(query); } catch (Exception EX) { throw; } return(result); }
public JsonResult GetSizeDetails(string UnitCodes) { UnitMaster size = new UnitMaster(); size = _unitservice.getBycode(UnitCodes); int id = size.UnitId; string name = size.UnitName; string code = size.UnitCode; return(Json(new { Id = id, name = name, code = code, }, JsonRequestBehavior.AllowGet)); }
//method to actually set evertyhing up void actualStart() { //gets the ground (gdm37::and the unit script) ground = gameObject.GetComponent<MakeGround>(); gridFunc = gameObject.GetComponent<GridFunction>(); units = gameObject.GetComponent<UnitMaster>(); //gdm37 interaction = gameObject.GetComponent<InteractionControl>(); //gdm37 //used to set up attributes of board and then create it ground.SendMessage("setTerrainAttributes"); ground.SendMessage("startMakeGrid"); //gdm37:: used to create the units units.SendMessage("teamSetup"); isBattleGUIActive = false; }
public ResultModel Insert(UnitMasterModel obj) { ResultModel oOutput = new ResultModel(); try { UnitMaster oUnitMaster = Mapper.Map <UnitMaster>(obj); dbSet.Add(oUnitMaster); oDB.SaveChanges(); oOutput.Data = Mapper.Map <UnitMasterModel>(oUnitMaster); } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public HttpResponseMessage PutUnit(UnitMast unit) { try { if (ModelState.IsValid) { var result = new UnitMaster().Unit_Update(unit); if (result != null || result != "") { return(Request.CreateResponse(HttpStatusCode.OK, result)); } } return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
// GET: UnitMaster/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnitMaster unitMaster = db.UnitMasters.Find(id); if (unitMaster == null) { return(HttpNotFound()); } long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View(unitMaster)); }
public int tblUnitMasterAddEdit(UnitMaster _clstblUnitMaster, byte _byteAction, DBAccess _DBAccess) { try { _DBAccess.Parameters.Clear(); _DBAccess.AddParameter("@strUnitName", _clstblUnitMaster.strUnitName); if (_byteAction == 1) { var _SqlParameter = new SqlParameter("@intUnitID", 0); _SqlParameter.Direction = ParameterDirection.Output; _DBAccess.Parameters.Add(_SqlParameter); var _intReturnValue = _DBAccess.ExecuteNonQuery("sp_tblUnitMasterAdd"); if (_intReturnValue > 0) { return(Convert.ToInt32(_SqlParameter.Value)); } else { return(0); } } else { _DBAccess.AddParameter("@intUnitID", _clstblUnitMaster.intUnitID); var _intReturnValue = _DBAccess.ExecuteNonQuery("sp_tblUnitMasterEdit"); if (_intReturnValue > 0) { return(_clstblUnitMaster.intUnitID); } else { return(0); } } } catch (Exception _Exception) { throw _Exception; } }
public HttpResponseMessage DeleteUnit(int Pid) { var result = new UnitMaster().Unit_GetById(Pid); if (result.PID == 0) { return(Request.CreateResponse(HttpStatusCode.NoContent, result)); } try { result.PID = new UnitMaster().Unit_Delete(Pid); if (result.PID != 0) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } return(Request.CreateResponse(HttpStatusCode.NoContent, result)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, result)); } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); objunit = new UnitMaster() { MText = txt_unitname.Value.ToString(), MValue = txt_unitname.Value.ToString() }; txt_unitname.Value = ""; objcontext.UnitMasters.InsertOnSubmit(objunit); objcontext.SubmitChanges(); loadgrid(); } catch (Exception ex) { } finally { } }
private void FillGrid() { UnitMaster objUM = new UnitMaster(); List <UnitMaster> list = objUM.GetUnitMasterList(); if ((list != null)) { if (list.Count > 0) { int i; foreach (UnitMaster obj in list) { i = dgvMain.RowCount; dgvMain.RowCount = i + 1; dgvMain.Rows[i].Cells[0].Value = i + 1; dgvMain.Rows[i].Cells[1].Value = obj.ID; dgvMain.Rows[i].Cells[2].Value = obj.UnitName; } } } }
public ActionResult Index() { //JobsNotification Begin var JobsNotification = dbcontext.Job_Master.Where(i => i.JobID != 0).ToList(); ViewBag.JobsN = JobsNotification; //JobsNotification End //StudyMaterials Begin var StudyMaterialsNotification = dbcontext.StudyMaterials.Where(i => i.SM_Name != null).Take(3).ToList(); ViewBag.studymN = StudyMaterialsNotification; //StudyMaterials End var StudentName = (from a in dbcontext.StudentProfiles.Where(x => x.EmailID == User.Identity.Name) select a.Name).FirstOrDefault(); ViewBag.name = StudentName; //Additional Question Request Begin var AddQueReq = (from Qreq in dbcontext.Stu_Additionalquestionrequest join user in dbcontext.StudentProfiles on Qreq.ProfileId equals user.Student_ID join course in dbcontext.Course_master on Qreq.Course equals course.Course_ID //where user.EmailID == User.Identity.Name select new QuestionRequestModel { StudentName = user.Name, Course = course.Name, Update = (bool)Qreq.Updated == true ? "Updated" : "Pending", }).Take(2).ToList(); ViewBag.QueReq = AddQueReq; //Additional Question Request End var Student = new GetUserByUserName(User.Identity.Name); var CourseID = Student.CourseID; var SemID = Student.SemID; var Student_ID = Student.Student_ID; var UnitID = Student.UnitID; var SubjectID = Student.SubjectID; List <Subject_Master> s = dbcontext.Subject_Master.Where(x => x.Course == CourseID && x.Semester == SemID).ToList(); Subject_Master sub = new Subject_Master { Name = "----please select Course----", SubjectID = 0 }; s.Insert(0, sub); SelectList selectsubject = new SelectList(s, "SubjectID", "Name", 0); ViewBag.selectedsubject = selectsubject; List <UnitMaster> u = dbcontext.UnitMasters.ToList(); UnitMaster unit = new UnitMaster { UnitName = "----Please select unit----", Uid = 0 }; u.Insert(0, unit); SelectList selectunit = new SelectList(u, "Uid", "UnitName", 0); ViewBag.selectedunit = selectunit; return(View()); }