public object Post(JArray post) { using (var db = new LUOLAI1401Context()) { for (var i = 0; i < post.Count; i++) { var form = post[i].ToObject <fw_Direct>(JsonExtension.FixJsonSerializer); var dbForm = db.fw_Direct.Find(form.dirid); RowState rowState = (RowState)(int)post[i]["_row_state"]; switch (rowState) { case RowState.Changed: dbForm.item = form.item; dbForm.corpname = form.corpname; dbForm.dirname = form.dirname; dbForm.dirvalue = form.dirvalue; dbForm.UpValue = form.UpValue; break; case RowState.Deleted: db.Entry(dbForm).State = System.Data.Entity.EntityState.Deleted; break; case RowState.New: form.dirid = (string)Newdirid(); db.fw_Direct.Add(form); break; } } db.SaveChanges(); return(true); } }
public object Post(JArray post) { using (var db = new LUOLAI1401Context()) { for (var i = 0; i < post.Count; i++) { var form = post[i].ToObject <PM_Overdue>(JsonExtension.FixJsonSerializer); var dbForm = db.PM_Overdue.Find(form.FID); RowState rowState = (RowState)(int)post[i]["_row_state"]; switch (rowState) { case RowState.Changed: dbForm.CustID = form.CustID; dbForm.Amt = form.Amt; break; case RowState.Deleted: db.Entry(dbForm).State = System.Data.Entity.EntityState.Deleted; break; case RowState.New: form.FID = int.Parse((string)NewFID()); db.PM_Overdue.Add(form); break; } } db.SaveChanges(); return(true); } }
/** * Constructor */ public Bank(MemSched sched, MemCtlr MC) { //bank id bank_id = bank_max; bank_max++; Console.WriteLine("bank" + '\t' + bank_id.ToString() + '\t' + MC.mem_id.ToString()); //set scheduler this.sched = sched; //allocate stat stat = new BankStat(this); outstandingReqs_perapp = new ulong[Config.N]; outstandingReqs = 0; //initialize bank state state = RowState.Closed; cur_row = ulong.MaxValue; is_cur_marked = false; wait_left = 0; this.MC = MC; lastOpen.Clear(); }
public CommonPage(Int32 id, String title, String menuCaption, RowState state) { this.id = id; this.title = title; this.menuCaption = menuCaption; this.state = state; }
/// <summary> /// 獲取變更資料 /// </summary> /// <param name="oldModel"></param> /// <param name="newModel"></param> /// <returns></returns> private byte[] GetChangeData(int tbIdx, dynamic oldModel, dynamic newModel, RowState rowState) { Dictionary <string, object[]> changeFieldsDic = GetChangeDataDic(tbIdx, oldModel, newModel, rowState); string json = JsonConvert.SerializeObject(changeFieldsDic); return(CompressJsonVal(json)); }
public void SetState(RowState state) { this.state = state; LeftCell.SetState(new CellState() { PlayerPiece = state.leftCell.piece, DisplayPiece = state.leftCell.piece, OwnerId = state.leftCell.ownerid, CurrentTurnId = state.currentTurnId, CurrentTurnPiece = state.currentTurnPiece }); MiddleCell.SetState(new CellState() { PlayerPiece = state.middleCell.piece, DisplayPiece = state.middleCell.piece, OwnerId = state.middleCell.ownerid, CurrentTurnId = state.currentTurnId, CurrentTurnPiece = state.currentTurnPiece }); RightCell.SetState(new CellState() { PlayerPiece = state.rightCell.piece, DisplayPiece = state.rightCell.piece, OwnerId = state.rightCell.ownerid, CurrentTurnId = state.currentTurnId, CurrentTurnPiece = state.currentTurnPiece }); }
/** * Set a memory request to the bank. * This can only be done if there are no requests currently being serviced. * Time left to service the request is set to full value. * @param req the memory request */ public void add_req(MemoryRequest req) { //check if current request has been serviced Debug.Assert(cur_req == null); //proceed to service new request; update as the current request cur_req = req; is_cur_marked = cur_req.isMarked; //----- STATS START ----- stat.inc(ref BankStat.req_cnt[cur_req.request.requesterID]); //Simulator.stats.bank_access_persrc[bank_id, cur_req.request.requesterID].Add(); if (cur_req.isMarked) { stat.inc(ref BankStat.marked_req_cnt[cur_req.request.requesterID]); } else { stat.inc(ref BankStat.unmarked_req_cnt[cur_req.request.requesterID]); } //----- STATS END ------ //time to serve the request; bus latency wait_left = Config.memory.bus_busy_time; //time to serve the request; row access latency if (state == RowState.Closed) { //row is closed wait_left += Config.memory.row_closed_latency; state = RowState.Open; } else { //row is open if (cur_req.r_index == cur_row && !Config.memory.row_same_latency) { //hit stat.inc(ref stat.row_hit); stat.inc(ref stat.row_hit_per_proc[cur_req.request.requesterID]); //Simulator.stats.bank_rowhits_persrc[bank_id, cur_req.request.requesterID].Add(); wait_left += Config.memory.row_hit_latency; } else { //conflict stat.inc(ref stat.row_miss); stat.inc(ref stat.row_miss_per_proc[cur_req.request.requesterID]); wait_left += Config.memory.row_conflict_latency; //Close row, mark last cycle row to be closed was open lastOpen[cur_row] = Simulator.CurrentRound; } } //set as current row cur_row = cur_req.r_index; }
public object Post(JArray data) { using (var db = new SysContext()) { for (int i = 0; i < data.Count; i++) { JObject obj = data[i] as JObject; RowState rowState = (RowState)(int)obj["_row_state"]; sys_parameter parameter = obj.ToObject <sys_parameter>(); switch (rowState) { case RowState.Changed: db.Entry(parameter).State = System.Data.Entity.EntityState.Modified; break; case RowState.New: db.sys_parameter.Add(parameter); break; case RowState.Deleted: db.Entry(parameter).State = System.Data.Entity.EntityState.Deleted; break; } } db.SaveChanges(); } return(true); }
public GridRow(string location, string status) { Location = location; Status = status; ButtonText = "Parse"; State = RowState.Ready; }
protected internal override void DrawItem(Graphics g, Rectangle rc, object item, RowState state, string highlightText) { int midPoint = (rc.Left + rc.Right) / 2; Rectangle rcCheck = new Rectangle(midPoint - 7, rc.Top, 15, 15); CheckBoxState checkState = GetItemCheckState(item); if (checkState != CheckBoxState.Hidden) { ButtonState buttonState; switch (checkState) { case CheckBoxState.Checked: buttonState = ButtonState.Checked; break; case CheckBoxState.Grayed: buttonState = ButtonState.Inactive; break; default: buttonState = ButtonState.Normal; break; } if ((state & RowState.Disabled) != 0) { buttonState |= ButtonState.Inactive; } OwnerControl.ControlPainter.DrawCheckBox(g, rcCheck, buttonState); } }
protected override void DrawItemText(Graphics g, Rectangle rcText, object item, Color textColor, RowState state, string highlightText) { IResource res = (IResource)item; string text = GetItemText(item); if (text == "") { SetCachedPreviewHeight(res, 0); return; } StringFormat fmt = GetColumnStringFormat(); Font itemFont = GetItemFont(item); int oldHeight = GetAutoPreviewHeight(res.Id); g.DrawLine(_barPen, rcText.X + 2, rcText.Y + 1, rcText.X + 2, rcText.Y + rcText.Height - 2); ShiftRectForText(ref rcText); int height = Owner.ControlPainter.DrawText(g, text, itemFont, textColor, rcText, fmt) + 2; if (height != oldHeight && height < _defaultPreviewHeight) { ChangeItemHeight(res, oldHeight, height); } }
public Downloads(Int32 id, String catagory, String amharicText, RowState state) { this.id = id; this.catagory = catagory; this.amharicText = amharicText; this.state = state; }
public PhotoGalleryCatagory(Int32 id, String catagoryName, String publish, RowState state) { this.id = id; this.catagoryName = catagoryName; this.publish = publish; this.state = state; }
public Vehicle(DbDataReader reader) { Id = (int)reader["id"]; VehicleMark = new VehicleMark((int)reader["vehicleMark"], (string)reader["nameMark"]); LicensePlate = (string)reader["licensePlate"]; rowState = RowState.Readed; }
public Links(Int32 iD, String urlText, String url, String publish, RowState state) { this.iD = iD; this.urlText = urlText; this.url = url; this.publish = publish; this.state = state; }
public DocumentType(Byte id, String name, String imgUrl, String language, RowState state) { this.id = id; this.name = name; this.imgUrl = imgUrl; this.language = language; this.state = state; }
private Vehicle(int id, VehicleMark vehicleMark, string licensePlate) { Id = id; VehicleMark = vehicleMark; LicensePlate = licensePlate; rowState = RowState.Readed; }
public Vehicle() { Id = 0; VehicleMark = VehicleMark.Empty; LicensePlate = ""; rowState = RowState.Inserted; }
public Faq(Int32 iD, String question, String answer, String publish, RowState state) { this.iD = iD; this.question = question; this.answer = answer; this.publish = publish; this.state = state; }
public object Post(JObject post) { var form = post["form"].ToObject <wq_termPop>(JsonExtension.FixJsonSerializer); using (var db = new LUOLAI1401Context()) { var dbForm = db.wq_termPop.Find(form.PopCode); if (dbForm == null) { db.wq_termPop.Add(form); } else { dbForm.PopName = form.PopName; dbForm.Address = form.Address; dbForm.Contact1 = form.Contact1; dbForm.Tel1 = form.Tel1; dbForm.Mobile1 = form.Mobile1; dbForm.Contact2 = form.Contact2; dbForm.Tel2 = form.Tel2; dbForm.Mobile2 = form.Mobile2; } // 记录多级零时主键对应(key int 为 js 生成的页内全局唯一编号) var _id_maps = new Dictionary <int, object[]>(); if (post["wq_Pop_Dealer"] != null) { var sub = post["wq_Pop_Dealer"] as JArray; if (sub.Count > 0) { for (int i = 0; i < sub.Count; i++) { JObject obj = sub[i] as JObject; RowState rowState = (RowState)(int)obj["_row_state"]; var model = obj.ToObject <wq_Pop_Dealer>(JsonExtension.FixJsonSerializer); switch (rowState) { case RowState.Changed: db.Entry(model).State = System.Data.Entity.EntityState.Modified; break; case RowState.New: model.PopCode = form.PopCode; model.id = new SysSerialServices().GetNewSerial("wq_Pop_Dealer." + form.PopCode, null); db.wq_Pop_Dealer.Add(model); break; case RowState.Deleted: db.Entry(model).State = System.Data.Entity.EntityState.Deleted; break; } } } } db.SaveChanges(); } return(new { success = true, form = form }); }
public PhotoGallery(Int32 id, String title, String thumbnails, String normalPicture, String publish, Int32 catagory, RowState state) { this.id = id; this.title = title; this.thumbnails = thumbnails; this.normalPicture = normalPicture; this.publish = publish; this.catagory = catagory; this.state = state; }
protected override void DrawItem(Graphics g, Rectangle rc, object item, RowState state, string highlightText) { IResource res = item as IResource; if (res != null) { DrawResourceIcon(g, res, rc, state); } }
protected override void DrawItemText(Graphics g, Rectangle rcText, object item, Color textColor, RowState state, string highlightText) { IResource res = (IResource)item; RichText text = GetRichText(res); FormatRowRichText(ref text, textColor, state, highlightText); text.DrawClipped(g, rcText); }
public FeedBack(String firstName, String lastName, String email, String subject, String comment, String status, RowState state) { this.firstName = firstName; this.lastName = lastName; this.email = email; this.subject = subject; this.comment = comment; this.status = status; this.state = state; }
public Users(Int32 iD, String userName, String passWord, String firstName, String middleName, String lastName, Boolean loggedIn, RowState state) { this.iD = iD; this.userName = userName; this.passWord = passWord; this.firstName = firstName; this.middleName = middleName; this.lastName = lastName; this.loggedIn = loggedIn; this.state = state; }
/// <summary> /// Commits all the changes made to this row since the last time AcceptChanges was called. /// </summary> /// <remarks> /// If the <see cref="State"/> of the row was Added or Modified, the <see cref="State"/> becomes Unchanged. /// If the <see cref="State"/> was Deleted, the row is removed (<see cref="State"/> becomes Detached). /// </remarks> public void AcceptChanges() { if ((rowState & RowState.Deleted) == RowState.Deleted) { Detach(); } else if (rowState != RowState.Detached) { rowState = RowState.Unchanged; } }
/// <summary> /// Deletes the <see cref="RecordSet.Row"/>. /// </summary> /// <remarks> /// If the <see cref="State"/> of the row is Added, the <see cref="State"/> becomes Detached and the row is removed from the table when you call <see cref="RecordSet.AcceptChanges"/>. /// The <see cref="State"/> becomes Deleted after you use the <see cref="Delete"/> method on an existing <see cref="Row"/>. /// It remains Deleted until you call <see cref="RecordSet.AcceptChanges"/>. /// </remarks> public void Delete() { if ((rowState & RowState.Added) == RowState.Added) { Detach(); } else { rowState = RowState.Deleted; } }
public JsonResult GameJudgesSave(List <GameJudge> judges, RowState rState) { try { //新增时,排重 if (rState == RowState.Added) { Request <Game> req = new Request <Game>(); req.Token = CurrentUser.Token; req.Filter = new Game { Id = judges[0].GameId }; var res = ServiceBuilder.GetInstance().Execute(ServiceType.GetGameJudgeList, req); bool flag; judges.ForEach(j => { flag = true; res.Entities.ForEach(p => { GameJudge o = p as GameJudge; if (o.UserId.GetId() == j.UserId) { flag = false; return; } }); if (flag) { j.RowState = rState; } }); } else { judges.ForEach(p => { p.RowState = rState; }); } Request <GameJudge> request = new Request <GameJudge>(); request.Token = CurrentUser.Token; request.Entities = judges; var result = ServiceBuilder.GetInstance().Execute(ServiceType.SaveGameJudge, request); return(ToJson(result)); } catch (Exception ex) { var errResult = ResultHelper.Fail(ex.Message); return(ToJson(errResult)); } }
public object Post(JObject post) { var form = post["form"].ToObject <wq_patrolPrmPicsSet>(JsonExtension.FixJsonSerializer); using (var db = new LUOLAI1401Context()) { var dbForm = db.wq_patrolPrmPicsSet.Find(form.code); if (dbForm == null) { form.compcode = string.Format("{0}", (System.Web.HttpContext.Current.Session["sys_user"] as sys_user).CompCode); db.wq_patrolPrmPicsSet.Add(form); } else { dbForm.name = form.name; dbForm.bgtime = form.bgtime; dbForm.edtime = form.edtime; dbForm.CONTENT = form.CONTENT; } if (post["wq_patrolPrmPicsSet_bd"] != null) { var sub = post["wq_patrolPrmPicsSet_bd"] as JArray; if (sub.Count > 0) { for (int i = 0; i < sub.Count; i++) { JObject obj = sub[i] as JObject; RowState rowState = (RowState)(int)obj["_row_state"]; var model = obj.ToObject <wq_patrolPrmPicsSet_bd>(JsonExtension.FixJsonSerializer); switch (rowState) { case RowState.Changed: db.Entry(model).State = System.Data.Entity.EntityState.Modified; break; case RowState.New: model.code = form.code; model.Series = new SysSerialServices().GetNewSerial("wq_patrolPrmPicsSet_bd." + form.code, null); db.wq_patrolPrmPicsSet_bd.Add(model); break; case RowState.Deleted: db.Entry(model).State = System.Data.Entity.EntityState.Deleted; break; } } } } db.SaveChanges(); } return(new { success = true, form = form }); }
internal void DrawResourceIcon(Graphics g, IResource res, Rectangle rc, RowState state) { int midPointX = rc.Left + Width / 2; int midPointY = (rc.Top + rc.Bottom) / 2; int index = Core.ResourceIconManager.GetIconIndex(res); DrawSingleIcon(state, g, index, rc, midPointX, midPointY); int[] overlayIcons = Core.ResourceIconManager.GetOverlayIconIndices(res); for (int i = 0; i < overlayIcons.Length; i++) { DrawSingleIcon(state, g, overlayIcons [i], rc, midPointX, midPointY); } }
public void ApplyChange() { switch (State) { case RowState.Changed: UpdateCompany(); this.State = RowState.Existing; break; case RowState.Create: CreateCompany(); this.State = RowState.Existing; break; case RowState.Deleted: RemoveCompany(); break; case RowState.Existing: break; } }
public Company() { this.State = RowState.Create; }
public Company(int id) { this.ID = id; FindCompany(); this.State = RowState.Existing; }
/** * Set a memory request to the bank. * This can only be done if there are no requests currently being serviced. * Time left to service the request is set to full value. * @param req the memory request */ public void add_req(MemoryRequest req) { //check if current request has been serviced Debug.Assert(cur_req == null); //proceed to service new request; update as the current request cur_req = req; is_cur_marked = cur_req.isMarked; //----- STATS START ----- stat.inc(ref BankStat.req_cnt[cur_req.request.requesterID]); //Simulator.stats.bank_access_persrc[bank_id, cur_req.request.requesterID].Add(); if (cur_req.isMarked) stat.inc(ref BankStat.marked_req_cnt[cur_req.request.requesterID]); else stat.inc(ref BankStat.unmarked_req_cnt[cur_req.request.requesterID]); //----- STATS END ------ //time to serve the request; bus latency wait_left = Config.memory.bus_busy_time; //time to serve the request; row access latency if (state == RowState.Closed) { //row is closed wait_left += Config.memory.row_closed_latency; state = RowState.Open; } else { //row is open if (cur_req.r_index == cur_row && !Config.memory.row_same_latency) { //hit stat.inc(ref stat.row_hit); stat.inc(ref stat.row_hit_per_proc[cur_req.request.requesterID]); //Simulator.stats.bank_rowhits_persrc[bank_id, cur_req.request.requesterID].Add(); wait_left += Config.memory.row_hit_latency; } else { //conflict stat.inc(ref stat.row_miss); stat.inc(ref stat.row_miss_per_proc[cur_req.request.requesterID]); wait_left += Config.memory.row_conflict_latency; //Close row, mark last cycle row to be closed was open lastOpen[cur_row] = Simulator.CurrentRound; } } //set as current row cur_row = cur_req.r_index; }
public PassData(int id) { this.ID = id; FindPassData(); this.State = RowState.Existing; }
/// <summary> /// Adds an actual value to the grid. /// </summary> private void AddActualValue(TestData.DataValue value, RowState type) { DataRow row = m_dataset.Tables[0].NewRow(); row[0] = TestData.FormatTimestamp(value.SourceTimestamp); row[1] = String.Empty; row[2] = String.Empty; row[3] = String.Empty; row[4] = String.Empty; row[5] = String.Empty; row[6] = String.Empty; row[8] = value.Comment; UpdateActualValue(row, value, type); m_dataset.Tables[0].Rows.Add(row); }
/// <summary> /// Updates an actual value in the grid. /// </summary> private void UpdateActualValue(DataRow row, TestData.DataValue value, RowState type) { if (value != null) { row[5] = TestData.FormatValue(value.WrappedValue); row[6] = TestData.FormatQuality(value.StatusCode); } else { row[5] = String.Empty; row[6] = String.Empty; } row[7] = type.ToString(); }
/// <summary> /// Updates an expected value in the grid. /// </summary> private void UpdateExpectedValue(DataRow row, TestData.DataValue value, RowState type) { if (type != RowState.MissingExpected) { row[3] = TestData.FormatValue(value.WrappedValue); row[4] = TestData.FormatQuality(value.StatusCode); } else { row[3] = String.Empty; row[4] = String.Empty; } row[7] = type.ToString(); row[8] = value.Comment; }
public PassData() { this.State = RowState.Create; this.IssuedDate = this.DateOfBirth = DateTime.Now; }