///<summary>Inserts one Adjustment into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Adjustment adjustment,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { adjustment.AdjNum=ReplicationServers.GetKey("adjustment","AdjNum"); } string command="INSERT INTO adjustment ("; if(useExistingPK || PrefC.RandomKeys) { command+="AdjNum,"; } command+="AdjDate,AdjAmt,PatNum,AdjType,ProvNum,AdjNote,ProcDate,ProcNum,DateEntry,ClinicNum) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(adjustment.AdjNum)+","; } command+= POut.Date (adjustment.AdjDate)+"," +"'"+POut.Double(adjustment.AdjAmt)+"'," + POut.Long (adjustment.PatNum)+"," + POut.Long (adjustment.AdjType)+"," + POut.Long (adjustment.ProvNum)+"," +"'"+POut.String(adjustment.AdjNote)+"'," + POut.Date (adjustment.ProcDate)+"," + POut.Long (adjustment.ProcNum)+"," + DbHelper.Now()+"," + POut.Long (adjustment.ClinicNum)+")"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { adjustment.AdjNum=Db.NonQ(command,true); } return adjustment.AdjNum; }
public bool DeleteAdjustment(Adjustment adjustment) { if (adjustment == null) return false; _unitOfWork.AdjustmentRepository.Delete(adjustment); _unitOfWork.Save(); return true; }
public ObjectListWidget(Application application, Adjustment adjv) { this.application = application; SetSizeRequest( COLUMN_WIDTH * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; AddEvents((int) Gdk.EventMask.ButtonPressMask); AddEvents((int) Gdk.EventMask.AllEventsMask); AddEvents((int) Gdk.EventMask.ScrollMask); Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, DragTargetEntries, DragAction.Copy | DragAction.Default); SizeAllocated += OnSizeAllocated; DragBegin += OnDragBegin; DragEnd += OnDragEnd; ScrollEvent += OnScroll; DragDataGet += OnDragDataGet; application.LevelChanged += OnLevelChanged; vadjustment = adjv; vadjustment.ValueChanged += OnVAdjustmentChangedValue; HasTooltip = true; QueryTooltip += OnQueryTooltip; }
public TileListWidget(Application application, TileSelection selection, Adjustment adjv) { this.selection = selection; selection.Changed += OnSelectionChanged; this.application = application; Tileset.LoadEditorImages = true; SetSizeRequest((TILE_WIDTH + SPACING_X) * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; ButtonReleaseEvent += OnButtonRelease; MotionNotifyEvent += OnMotionNotify; ScrollEvent += OnScroll; AddEvents((int) Gdk.EventMask.ButtonPressMask); AddEvents((int) Gdk.EventMask.ButtonReleaseMask); AddEvents((int) Gdk.EventMask.PointerMotionMask); AddEvents((int) Gdk.EventMask.ScrollMask); SizeAllocated += OnSizeAllocated; application.LevelChanged += OnLevelChanged; vadjustment = adjv; vadjustment.ValueChanged += OnVAdjustmentChangedValue; }
///<summary>Inserts one Adjustment into the database. Returns the new priKey.</summary> internal static long Insert(Adjustment adjustment) { if(DataConnection.DBtype==DatabaseType.Oracle) { adjustment.AdjNum=DbHelper.GetNextOracleKey("adjustment","AdjNum"); int loopcount=0; while(loopcount<100){ try { return Insert(adjustment,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ adjustment.AdjNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(adjustment,false); } }
public ScrollBarRenderView(RenderView renderview) : base(2, 2, false) { this.renderview = renderview; Attach(renderview, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); Adjustment hadjustment = new Adjustment(0, -10, 10, 1, 2, 2); HScrollbar hscroll = new HScrollbar(hadjustment); Attach(hscroll, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); Adjustment vadjustment = new Adjustment(0, -10, 10, 1, 2, 2); VScrollbar vscroll = new VScrollbar(vadjustment); Attach(vscroll, 1, 2, 0, 1, 0, AttachOptions.Expand | AttachOptions.Fill, 0, 0); renderview.SetAdjustments(hadjustment, vadjustment); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<Adjustment> TableToList(DataTable table){ List<Adjustment> retVal=new List<Adjustment>(); Adjustment adjustment; for(int i=0;i<table.Rows.Count;i++) { adjustment=new Adjustment(); adjustment.AdjNum = PIn.Long (table.Rows[i]["AdjNum"].ToString()); adjustment.AdjDate = PIn.Date (table.Rows[i]["AdjDate"].ToString()); adjustment.AdjAmt = PIn.Double(table.Rows[i]["AdjAmt"].ToString()); adjustment.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); adjustment.AdjType = PIn.Long (table.Rows[i]["AdjType"].ToString()); adjustment.ProvNum = PIn.Long (table.Rows[i]["ProvNum"].ToString()); adjustment.AdjNote = PIn.String(table.Rows[i]["AdjNote"].ToString()); adjustment.ProcDate = PIn.Date (table.Rows[i]["ProcDate"].ToString()); adjustment.ProcNum = PIn.Long (table.Rows[i]["ProcNum"].ToString()); adjustment.DateEntry = PIn.Date (table.Rows[i]["DateEntry"].ToString()); adjustment.ClinicNum = PIn.Long (table.Rows[i]["ClinicNum"].ToString()); adjustment.StatementNum= PIn.Long (table.Rows[i]["StatementNum"].ToString()); retVal.Add(adjustment); } return retVal; }
///<summary>Updates one Adjustment in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> internal static void Update(Adjustment adjustment,Adjustment oldAdjustment) { string command=""; if(adjustment.AdjDate != oldAdjustment.AdjDate) { if(command!=""){ command+=",";} command+="AdjDate = "+POut.Date(adjustment.AdjDate)+""; } if(adjustment.AdjAmt != oldAdjustment.AdjAmt) { if(command!=""){ command+=",";} command+="AdjAmt = '"+POut.Double(adjustment.AdjAmt)+"'"; } if(adjustment.PatNum != oldAdjustment.PatNum) { if(command!=""){ command+=",";} command+="PatNum = "+POut.Long(adjustment.PatNum)+""; } if(adjustment.AdjType != oldAdjustment.AdjType) { if(command!=""){ command+=",";} command+="AdjType = "+POut.Long(adjustment.AdjType)+""; } if(adjustment.ProvNum != oldAdjustment.ProvNum) { if(command!=""){ command+=",";} command+="ProvNum = "+POut.Long(adjustment.ProvNum)+""; } if(adjustment.AdjNote != oldAdjustment.AdjNote) { if(command!=""){ command+=",";} command+="AdjNote = '"+POut.String(adjustment.AdjNote)+"'"; } if(adjustment.ProcDate != oldAdjustment.ProcDate) { if(command!=""){ command+=",";} command+="ProcDate = "+POut.Date(adjustment.ProcDate)+""; } if(adjustment.ProcNum != oldAdjustment.ProcNum) { if(command!=""){ command+=",";} command+="ProcNum = "+POut.Long(adjustment.ProcNum)+""; } //DateEntry not allowed to change if(adjustment.ClinicNum != oldAdjustment.ClinicNum) { if(command!=""){ command+=",";} command+="ClinicNum = "+POut.Long(adjustment.ClinicNum)+""; } if(command==""){ return; } command="UPDATE adjustment SET "+command +" WHERE AdjNum = "+POut.Long(adjustment.AdjNum); Db.NonQ(command); }
public void SetMediumTemperatureMode() { temperatureMode = Adjustment.medium; }
public void SetHighTemperatureMode() { temperatureMode = Adjustment.high; }
public void SetMediumBrightness() { brightness = Adjustment.medium; }
public void SetHighBrightness() { brightness = Adjustment.high; }
public HeatingSystem(string name, bool state, Adjustment temperatureMode) : base(name, state, temperatureMode) { }
// raise adjustment // done public static bool RaiseAdjustments(int empId, List <ItemVM> iList) { using (SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext()) { try { // for email List <AdjustmentVM> adjList = new List <AdjustmentVM>(); string vNum = GenerateVoucherNo(); for (int i = 0; i < iList.Count; i++) { if ((iList[i].TempQtyCheck - iList[i].Balance) != 0) { Adjustment a = new Adjustment(); a.VoucherNo = vNum; a.EmpId = empId; a.DateTimeIssued = DateTime.Now; a.ItemCode = iList[i].ItemCode; a.Reason = iList[i].TempReason; a.QtyChange = (int)iList[i].TempQtyCheck - iList[i].Balance; a.Status = "Submitted"; Employee emp = new Employee(); emp = entities.Employees.Where(x => x.Role.Equals("Store Supervisor")).FirstOrDefault(); double chgBck = a.QtyChange * iList[i].Price1; if (a.QtyChange < 0) { chgBck = chgBck * -1; } if (chgBck >= 250) { emp = entities.Employees.Where(x => x.Role.Equals("Store Manager")).FirstOrDefault(); } a.ApproverId = emp.EmpId; a.ApproverComment = ""; entities.Adjustments.Add(a); entities.SaveChanges(); // for email AdjustmentVM adj = new AdjustmentVM(); adj.VoucherNo = a.VoucherNo; adj.EmpId = a.EmpId; adj.DateTimeIssued = a.DateTimeIssued; adj.ItemCode = a.ItemCode; adj.Reason = a.Reason; adj.QtyChange = a.QtyChange; adj.Status = a.Status; adj.ApproverId = (int)a.ApproverId; adj.ApproverComment = a.ApproverComment; adjList.Add(adj); int fromEmpIdA = empId; int toEmpIdA = emp.EmpId; string typeA = "Adjustment Request"; string contentA = vNum + " has been raised"; NotificationBL.AddNewNotification(fromEmpIdA, toEmpIdA, typeA, contentA); } } // for email EmailBL.SendAdjReqEmail(empId, adjList); return(true); } catch (Exception ex) { throw ex; } } }
static void Main() { Application.Init(); // Gtk# init Console.WriteLine("Application starting up"); // Create HScale slider before Button, but add them in opposite order // see http://www.gtk.org/tutorial1.2/gtk_tut-7.html // http://inti.sourceforge.net/tutorial/libinti/rangewidgets.html // http://www.mono-project.com/docs/gui/gtksharp/widgets/range-widgets/ Adjustment adj = new Adjustment( 5.0d, // Initial value 0.0d, // Lower limit 10.0d, // Upper limit 0.5, // Step increment 2.0d, // Page increment 0.0d // Page size, seems like it should be 0 for a slider, // as it's non-panning, and it avoid surprising subtraction ); HScale hs = new HScale(adj); var p = new PositionType(); hs.AddMark(0.1, p, null); // breaks build in Windows! // hs.addMark SHOULD BE AVAILABLE! Old GTK# library? Label label = new Label("Start timer threads"); Button btn = new Button(label); btn.Clicked += new EventHandler( (object obj, EventArgs args) => { hello(hs,label); } ); Window window = new Window("Timer Thread Demo"); // when this window is deleted, run delete_event() window.DeleteEvent += delete_event; Box box = new VBox(); box.Add(btn); box.Add(hs); window.Add(box); window.ShowAll(); Application.Run(); }
public ConsoleView(Adjustment hadjustment, Adjustment vadjustment) : base(hadjustment, vadjustment) { }
public SpinButtonLocalized(Adjustment adjustment, double climb_rate, uint digits) : base(adjustment, climb_rate, digits) { }
private bool ShowDock(Gdk.Event evnt) { Adjustment adj = slider.Adjustment; int x, y, m, dx, dy, sx, sy, ystartoff; uint event_time; double v; if (previous_volume != (int)slider.Adjustment.Lower) { previous_volume = Volume; } if (evnt is Gdk.EventKey) { event_time = ((Gdk.EventKey)evnt).Time; } else if (evnt is Gdk.EventButton) { event_time = ((Gdk.EventButton)evnt).Time; } else if (evnt is Gdk.EventScroll) { event_time = ((Gdk.EventScroll)evnt).Time; } else { throw new ApplicationException("ShowDock expects EventKey, EventButton, or EventScroll"); } dock.Screen = Screen; GdkWindow.GetOrigin(out x, out y); x += Allocation.X; y += Allocation.Y; dock.Move(x, y - (SCALE_SIZE / 2)); dock.ShowAll(); dock.GdkWindow.GetOrigin(out dx, out dy); dy += dock.Allocation.Y; slider.GdkWindow.GetOrigin(out sx, out sy); sy += slider.Allocation.Y; ystartoff = sy - dy; timeout = true; v = Volume / (adj.Upper - adj.Lower); x += (Allocation.Width - dock.Allocation.Width) / 2; y -= ystartoff; y -= slider.MinSliderSize / 2; m = slider.Allocation.Height - slider.MinSliderSize; y -= (int)(m * (1.0 - v)); if (evnt is Gdk.EventButton) { y += (int)((Gdk.EventButton)evnt).Y; } else if (evnt is Gdk.EventScroll) { y += (int)((Gdk.EventScroll)evnt).Y; } dock.Move(x, y); slider.GdkWindow.GetOrigin(out sx, out sy); bool base_result = evnt is Gdk.EventButton ? base.OnButtonPressEvent((Gdk.EventButton)evnt) : true; Gtk.Grab.Add(dock); if (Gdk.Pointer.Grab(dock.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, event_time) != Gdk.GrabStatus.Success) { Gtk.Grab.Remove(dock); dock.Hide(); return(false); } if (Gdk.Keyboard.Grab(dock.GdkWindow, true, event_time) != Gdk.GrabStatus.Success) { Display.PointerUngrab(event_time); Gtk.Grab.Remove(dock); dock.Hide(); return(false); } if (evnt is Gdk.EventButton) { dock.GrabFocus(); Gdk.EventButton evnt_copy = (Gdk.EventButton)Gdk.EventHelper.Copy(evnt); m = slider.Allocation.Height - slider.MinSliderSize; UpdateEventButton(evnt_copy, slider.GdkWindow, slider.Allocation.Width / 2, ((1.0 - v) * m) + slider.MinSliderSize / 2); slider.ProcessEvent(evnt_copy); Gdk.EventHelper.Free(evnt_copy); } else { slider.GrabFocus(); } pop_time = event_time; return(base_result); }
public bool EditAdjustment(Adjustment adjustment) { _unitOfWork.AdjustmentRepository.Edit(adjustment); _unitOfWork.Save(); return(true); }
///<summary>Links charges to credits explicitly based on FKs first, then implicitly based on Date.</summary> private void LinkChargesToCredits() { #region Explicit for (int i = 0; i < _listAccountCharges.Count; i++) { AccountEntry charge = _listAccountCharges[i]; for (int j = 0; j < _listPaySplits.Count; j++) { PaySplit paySplit = _listPaySplits[j]; decimal paySplitAmt = (decimal)paySplit.SplitAmt; //Procedures that were being paid on through this payment plan should not get removed from this grid, even if they are fully paid off. if (charge.GetType() == typeof(Procedure) && paySplit.ProcNum == charge.PriKey && (paySplit.PayPlanNum == 0 || paySplit.PayPlanNum != _payPlanCur.PayPlanNum)) { charge.ListPaySplits.Add(paySplit); charge.AmountEnd -= paySplitAmt; _accountCredits -= paySplitAmt; charge.AmountStart -= paySplitAmt; } else if (charge.GetType() == typeof(PayPlanCharge) && ((PayPlanCharge)charge.Tag).PayPlanNum == paySplit.PayPlanNum && charge.AmountEnd > 0 && paySplit.SplitAmt > 0) { charge.AmountEnd -= paySplitAmt; _accountCredits -= paySplitAmt; } } for (int j = 0; j < _listAdjustments.Count; j++) { Adjustment adjustment = _listAdjustments[j]; decimal adjustmentAmt = (decimal)adjustment.AdjAmt; if (charge.GetType() == typeof(Procedure) && adjustment.ProcNum == charge.PriKey) { charge.AmountEnd += adjustmentAmt; if (adjustment.AdjAmt < 0) { _accountCredits += adjustmentAmt; } charge.AmountStart += adjustmentAmt; //If the adjustment is attached to a procedure decrease the procedure's amountoriginal so we know what it was just prior to autosplitting. } } for (int j = 0; j < _listPayPlanCharges.Count; j++) { PayPlanCharge payPlanCharge = _listPayPlanCharges[j]; if (charge.GetType() == typeof(Procedure) && payPlanCharge.ProcNum == charge.PriKey) //payPlanCharge.ProcNum will only be set for credits. { charge.AmountEnd -= (decimal)payPlanCharge.Principal; charge.AmountStart -= (decimal)payPlanCharge.Principal; _accountCredits -= (decimal)payPlanCharge.Principal; } } //Credits for the current payment plan don't get linked here, they get linked on the grid (Above) //for(int j = 0;j < ListPayPlanCreditsCur.Count;j++) { // PayPlanCharge payPlanCharge=ListPayPlanCreditsCur[j]; // if(charge.GetType()==typeof(Procedure) && payPlanCharge.ProcNum == charge.PriKey) { // charge.AmountEnd-=(decimal)payPlanCharge.Principal; // charge.AmountStart-=(decimal)payPlanCharge.Principal; // _accountCredits-=(decimal)payPlanCharge.Principal; // } //} // //claimprocs explicitly linked to the procedures for this patient. for (int j = 0; j < _listClaimProcs.Count; j++) { ClaimProc claimProcCur = _listClaimProcs[j]; if (charge.GetType() != typeof(Procedure) || claimProcCur.ProcNum != charge.PriKey) { continue; } decimal amt = 0; if ((claimProcCur.Status == ClaimProcStatus.Estimate || claimProcCur.Status == ClaimProcStatus.NotReceived)) { //Estimated Payment amt = (decimal)claimProcCur.InsEstTotal; if (claimProcCur.InsEstTotalOverride != -1) { amt = (decimal)claimProcCur.InsEstTotalOverride; } charge.AmountEnd -= amt; charge.AmountStart -= amt; //Estimated Writeoff amt = 0; if (claimProcCur.WriteOffEstOverride != -1) { amt = (decimal)claimProcCur.WriteOffEstOverride; } else if (claimProcCur.WriteOffEst != -1) { amt = (decimal)claimProcCur.WriteOffEst; } charge.AmountEnd -= amt; charge.AmountStart -= amt; } else if (claimProcCur.Status == ClaimProcStatus.Received || claimProcCur.Status == ClaimProcStatus.Supplemental || claimProcCur.Status == ClaimProcStatus.CapClaim || claimProcCur.Status == ClaimProcStatus.CapComplete) { //actual payment and actual writeoff. amt = (decimal)claimProcCur.InsPayAmt + (decimal)claimProcCur.WriteOff; charge.AmountEnd -= amt; charge.AmountStart -= amt; } } } #endregion Explicit //Apply negative charges as if they're credits. for (int i = 0; i < _listAccountCharges.Count; i++) { AccountEntry entryCharge = _listAccountCharges[i]; if (entryCharge.AmountEnd < 0) { _accountCredits -= entryCharge.AmountEnd; entryCharge.AmountEnd = 0; } } #region Implicit //Now we have a date-sorted list of all the unpaid charges as well as all non-attributed credits. //We need to go through each and pay them off in order until all we have left is the most recent unpaid charges. for (int i = 0; i < _listAccountCharges.Count && _accountCredits > 0; i++) { AccountEntry charge = _listAccountCharges[i]; decimal amt = Math.Min(charge.AmountEnd, _accountCredits); charge.AmountEnd -= amt; _accountCredits -= amt; charge.AmountStart -= amt; //Decrease amount original for the charge so we know what it was just prior to when the autosplits were made. } #endregion Implicit }
public bool EditAdjustment(Adjustment adjustment) { _unitOfWork.AdjustmentRepository.Edit(adjustment); _unitOfWork.Save(); return true; }
public void createAdjustment(Adjustment adjustment) { db.Adjustments.Add(adjustment); db.SaveChanges(); }
/// <summary> /// </summary> /// <param name="viewModel"></param> /// <param name="user"></param> /// <exception cref="System.Exception"></exception> public void SaveLossTrasnsaction(LossesAndAdjustmentsViewModel viewModel, UserProfile user) { Commodity commodity = _unitOfWork.CommodityRepository.FindById(viewModel.CommodityId); Adjustment lossAndAdjustment = new Adjustment(); TransactionGroup transactionGroup = new TransactionGroup(); Transaction transactionOne = new Transaction(); //transaction.TransactionGroupID = transactionGroupId; transactionOne.LedgerID = 2; transactionOne.HubOwnerID = user.DefaultHub.HubOwner.HubOwnerID; transactionOne.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, user.DefaultHub.HubID); // transactionOne.HubID = user.DefaultHub.HubID; transactionOne.StoreID = viewModel.StoreId; // transactionOne.ProjectCodeID = viewModel.ProjectCodeId; transactionOne.ShippingInstructionID = viewModel.ShippingInstructionId; transactionOne.ParentCommodityID = (commodity.ParentID == null) ? commodity.CommodityID : commodity.ParentID.Value; transactionOne.CommodityID = viewModel.CommodityId; transactionOne.ProgramID = viewModel.ProgramId; transactionOne.CommodityGradeID = null; // How did I get this value ? transactionOne.QuantityInMT = 0 - viewModel.QuantityInMt; transactionOne.QuantityInUnit = 0 - viewModel.QuantityInUint; transactionOne.UnitID = viewModel.UnitId; transactionOne.TransactionDate = DateTime.Now; Transaction transactionTwo = new Transaction(); //transactionToStore.TransactionGroupID = transactionGroupId; transactionTwo.LedgerID = 14; transactionTwo.HubOwnerID = user.DefaultHub.HubOwnerID; transactionTwo.AccountID =_accountService.GetAccountIdWithCreate(Account.Constants.HUB, user.DefaultHub.HubID); // transactionTwo.HubID = user.DefaultHub.HubID; transactionTwo.StoreID = viewModel.StoreId; // transactionTwo.ProjectCodeID = viewModel.ProjectCodeId; transactionTwo.ShippingInstructionID = viewModel.ShippingInstructionId; transactionTwo.ParentCommodityID = (commodity.ParentID == null) ? commodity.CommodityID : commodity.ParentID.Value; transactionTwo.CommodityID = viewModel.CommodityId; transactionTwo.ProgramID = viewModel.ProgramId; transactionTwo.CommodityGradeID = null; // How did I get this value ? transactionTwo.QuantityInMT = viewModel.QuantityInMt; transactionTwo.QuantityInUnit = viewModel.QuantityInUint; transactionTwo.UnitID = viewModel.UnitId; transactionTwo.TransactionDate = DateTime.Now; transactionGroup.Transactions.Add(transactionOne); transactionGroup.Transactions.Add(transactionTwo); lossAndAdjustment.PartitionID = 0; lossAndAdjustment.TransactionGroup = transactionGroup; lossAndAdjustment.HubID = user.DefaultHub.HubID; lossAndAdjustment.AdjustmentReasonID = viewModel.ReasonId; lossAndAdjustment.AdjustmentDirection = "L"; lossAndAdjustment.AdjustmentDate = viewModel.SelectedDate; lossAndAdjustment.ApprovedBy = viewModel.ApprovedBy; lossAndAdjustment.Remarks = viewModel.Description; lossAndAdjustment.UserProfileID = user.UserProfileID; lossAndAdjustment.ReferenceNumber = viewModel.MemoNumber; lossAndAdjustment.StoreManName = viewModel.StoreMan; // Try to save this transaction //db.Database.Connection.Open(); //DbTransaction dbTransaction = db.Database.Connection.BeginTransaction(); try { _unitOfWork.AdjustmentRepository.Add(lossAndAdjustment); _unitOfWork.Save(); //repository.Adjustment.Add(lossAndAdjustment); //dbTransaction.Commit(); } catch (Exception exp) { // dbTransaction.Rollback(); //TODO: Save the detail of this exception somewhere throw new Exception("The Internal Movement Transaction Cannot be saved. <br />Detail Message :" + exp.Message); } }
public String run() { // step 1: retrieve EMPLOYEE table from database SqlConnection con = new SqlConnection(); con.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["connection"]); SqlDataAdapter sc = new SqlDataAdapter("SELECT EID,SCID FROM EMPLOYEE", con); DataTable dte = new DataTable(); sc.Fill(dte); int said = 100; String test = ""; foreach(DataRow dr in dte.Rows) { said++; String eid = dr["EID"].ToString(); String scid = dr["SCID"].ToString(); //step 2: GET ADJUSTMENTS Adjustment adj = new Adjustment(Convert.ToInt32(eid)); double d = adj.getDeductionOnGross(); double i = adj.getIncrementOnBasic(); Salary salary = getSalary(Convert.ToInt32(scid), i, d); double basic = salary.getBasic(); double da = salary.getDA(); double hra = salary.getHRA(); double pf = salary.getPF(); double gross = salary.getGross(); double netpay = salary.getNetpay(); test = test + "--" + basic + "," + da + "," + hra + "," + pf + "," + gross + "," + netpay; //insertIntoDispatch(); SqlConnection con2 = new SqlConnection(); con2.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["connection"]); SqlCommand com2 = new SqlCommand("INSERT INTO DISPATCH (EID,MONTH,YEAR,BASIC,DA,HRA,PF,GROSS,NETPAY) VALUES("+eid+","+month+","+year+","+basic+","+da+","+hra+","+pf+","+gross+","+netpay+")", con2); con2.Open(); com2.ExecuteNonQuery(); con2.Close(); // step 3 insert all details into DISPATCH database table. } return "SUCCESSFULLY INSERTED"; }
public Lighting(string name, bool state, Adjustment brightness) : base(name, state) { this.brightness = brightness; }
/** * Add gtk adjustments for vertical and horizontal scrolling * (This is used for scrollbars) */ public void SetAdjustments(Adjustment hadjustment, Adjustment vadjustment) { this.vadjustment = vadjustment; this.hadjustment = hadjustment; if(vadjustment != null) { vadjustment.ValueChanged += OnVAdjustmentChanged; } if(hadjustment != null) { hadjustment.ValueChanged += OnHAdjustmentChanged; } UpdateAdjustments(); }
public void SetLowBrightness() { brightness = Adjustment.low; }
public List <AdjustmentDetail> findDetailByAdjustment(Adjustment adjust) { return(db.AdjustmentDetails.Where(x => x.AdjustmentId == adjust.AdjustmentId).ToList()); }
public ClimatDevice(string name, bool state, Adjustment temperatureMode) : base(name, state) { this.temperatureMode = temperatureMode; }
public IconList () : base () { status = new Gtk.Window ("status"); status_l = new Gtk.Label ("Status"); status.Add (status_l); //status.ShowAll (); SetSizeRequest (670, 370); CanFocus = true; Realized += new EventHandler (RealizeHanlder); Unrealized += new EventHandler (UnrealizeHandler); SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler); MotionNotifyEvent += new MotionNotifyEventHandler (MotionHandler); ButtonPressEvent += new ButtonPressEventHandler (ButtonHandler); KeyPressEvent += new KeyPressEventHandler (KeyPressHandler); KeyReleaseEvent += new KeyReleaseEventHandler (KeyReleaseHandler); ScrollEvent += new ScrollEventHandler (ScrollHandler); AddEvents ((int) (EventMask.ExposureMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask | EventMask.PointerMotionMask | EventMask.KeyPressMask | EventMask.ScrollMask | EventMask.KeyReleaseMask)); zoom = 1.0f; SetPreviewSize (160, 120); adjustment = new Adjustment (0, 0, 0, 0, 0, 0); adjustment.ValueChanged += new EventHandler (ValueChangedHandler); image_count = 0; Gtk.Settings s = Gtk.Settings.Default; double_click_time = (uint) s.DoubleClickTime; last_click_time = 0; }
public void SetLowTemperatureMode() { temperatureMode = Adjustment.low; }
/// <summary> /// Forces a scroll to bottom of our scrolled window. This is useful for the user to access easily the latest entry field. /// </summary> void ScrollToBottom() { Adjustment adj = mfss_scrolledwindow.Vadjustment; adj.Value = adj.Upper - adj.PageSize; }
///<summary>Updates one Adjustment in the database.</summary> internal static void Update(Adjustment adjustment) { string command="UPDATE adjustment SET " +"AdjDate = "+POut.Date (adjustment.AdjDate)+", " +"AdjAmt = '"+POut.Double(adjustment.AdjAmt)+"', " +"PatNum = "+POut.Long (adjustment.PatNum)+", " +"AdjType = "+POut.Long (adjustment.AdjType)+", " +"ProvNum = "+POut.Long (adjustment.ProvNum)+", " +"AdjNote = '"+POut.String(adjustment.AdjNote)+"', " +"ProcDate = "+POut.Date (adjustment.ProcDate)+", " +"ProcNum = "+POut.Long (adjustment.ProcNum)+", " //DateEntry not allowed to change +"ClinicNum= "+POut.Long (adjustment.ClinicNum)+" " +"WHERE AdjNum = "+POut.Long(adjustment.AdjNum); Db.NonQ(command); }
public Collection <Order> GetOrders() { var orders = new Collection <Order>(); _tblRrf = (DataTable)gridItemsChoice.DataSource; tblRRF = (DataTable)gridItemsChoice.DataSource; var info = new GeneralInfo(); info.LoadAll(); var client1 = new ServiceRRFLookupClient(); var req = new GetCurrentReportingPeriodRequest { Password = RRFServiceIntegration.PlitsPassword, UserName = RRFServiceIntegration.PlitsUserName, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var branchReq = new GetBranchRRFormRequest { UserName = RRFServiceIntegration.PlitsUserName, Password = RRFServiceIntegration.PlitsPassword, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var formReq = new GetFormsRequest { Password = RRFServiceIntegration.PlitsPassword, UserName = RRFServiceIntegration.PlitsUserName, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var forms = client1.GetForms(formReq).GetFormsResult; var formid = forms[0].Id; var periods = client1.GetCurrentReportingPeriod(req).GetCurrentReportingPeriodResult; var period = periods[0].Id; branchReq.Formid = formid; branchReq.Reportingperiodid = period; var chosenCatId = 91;//RRFHelper.GetRrfCategoryId(cboStores.Text); var rrfs = client1.GetBranchRRForm(branchReq).GetBranchRRFormResult; var formCategories = rrfs.First().FormCategories; var chosenCategoryBody = formCategories.First(x => x.Id == chosenCatId); //Hard coding to be removed. var items = chosenCategoryBody.Pharmaceuticals; //Let's just store the items here (May not be required) var user = new User(); user.LoadByPrimaryKey(CurrentContext.LoggedInUser.ID); var order = new HCMIS.Desktop.PLITSTransactionalService.Order { //Id = (int)rrf["Id"], RequestCompletedDate = BLL.DateTimeHelper.ServerDateTime,//Convert.ToDateTime(rrf["DateOfSubmissionEth"]), OrderCompletedBy = user.FullName, RequestVerifiedDate = BLL.DateTimeHelper.ServerDateTime, OrderTypeId = 1, //This needs to be changed to constant class or something. 1 - Regular, 2 - Emergency' SubmittedBy = user.FullName, SubmittedDate = BLL.DateTimeHelper.ServerDateTime, SupplyChainUnitId = Helpers.RRFServiceIntegration.GetBranchID(), OrderStatus = 1, //TODO: hardcoding FormId = formid, //TODO: hardcoding ReportingPeriodId = period //TODO: hardcoding }; // order.OrderTypeId = (int)tblrrf.Rows[i]["RRfTpyeId"]; // Set order properties //order.FormId = rrfForm.Id; //Form.ID? or RRFForm.ID? - doesn't make sense // order.ReportingPeriodId = periods[0].Id; //Asked again here? Because RRFForm already contains this. var details = new Collection <OrderDetail>(); int i = 0; var xx = tblRRF.Rows.Count; foreach (DataRow rrfLine in tblRRF.Rows) { var detail = new PLITSTransactionalService.OrderDetail(); var hcmisItemID = Convert.ToInt32(rrfLine["ID"]); var rrFormPharmaceutical = items.FirstOrDefault(x => x.PharmaceuticalId == Convert.ToInt32(rrfLine["ID"])); if (rrfLine != null && rrFormPharmaceutical != null) { detail.BeginningBalance = Convert.ToInt32(rrfLine["BeginingBalance"]); //DaysOutOfStock daysOfStockOut = new DaysOutOfStock() { NumberOfDaysOutOfStock = 1 }; //detail.DaysOutOfStocks.Add(daysOfStockOut);//Convert.ToInt32(rrfLine["DaysOutOfStock"]); int eBalance = Convert.ToInt32(rrfLine["SOH"]); detail.EndingBalance = eBalance == 0 ? 1 : eBalance; //To make sure ending balance is not zero. //detail.ItemId = Convert.ToInt32(rrfLine["ID"]); //Needs to come from the Code column of Items table. detail.QuantityReceived = Convert.ToInt32(rrfLine["Received"]); detail.QuantityOrdered = Convert.ToInt32(rrfLine["Quantity"]); detail.LossAdjustment = Convert.ToInt32(rrfLine["LossAdj"]); if (rrFormPharmaceutical != null) { detail.ItemId = rrFormPharmaceutical.ItemId; } else { throw new Exception("Item ID Mismatch"); } var rdDoc = new ReceiveDoc(); var lossAndAdjustment = new LossAndAdjustment(); rdDoc.GetAllWithQuantityLeft(hcmisItemID, _storeID); lossAndAdjustment.GetLossAdjustmentsForLastRRFPeriod(hcmisItemID, _storeID, periods[0].StartDate, periods[0].EndDate); int receiveDocEntries = rdDoc.RowCount; int disposalEntries = lossAndAdjustment.RowCount; rdDoc.Rewind(); for (var j = 0; j < receiveDocEntries; j++) { var exp = new Expiry { Amount = Convert.ToInt32(rdDoc.QuantityLeft), BatchNo = rdDoc.BatchNo, ExpiryDate = rdDoc.ExpDate }; detail.Expiries.Add(exp); rdDoc.MoveNext(); } lossAndAdjustment.Rewind(); for (var j = 0; j < disposalEntries; j++) { var adj = new Adjustment { Amount = Convert.ToInt32(lossAndAdjustment.Quantity), TypeId = 11, ReasonId = 39 }; detail.Adjustments.Add(adj); lossAndAdjustment.MoveNext(); } var stockoutIndexedLists = StockoutIndexBuilder.Builder.GetStockOutHistory(hcmisItemID, _storeID); for (int j = 0; j < stockoutIndexedLists.Count; j++) { var dos = new DaysOutOfStock { NumberOfDaysOutOfStock = stockoutIndexedLists[j].NumberOfDays, StockOutReasonId = 5 }; detail.DaysOutOfStocks.Add(dos); } details.Add(detail); } } order.OrderDetails = details; orders.Add(order); // loop through each record and create order & order details objects return(orders); //var user = new User(); //user.LoadByPrimaryKey(NewMainWindow.LoggedInUser.ID); //foreach (DataRow rrf in tblRRF.Rows) //{ // var order = new HCMIS.Desktop.PLITSTransactionalService.Order // { // Id = (int)rrf["Id"], // RequestCompletedDate = DateTime.Now,//Convert.ToDateTime(rrf["DateOfSubmissionEth"]), // OrderCompletedBy = user.FullName, // RequestVerifiedDate = DateTime.Now, // OrderTypeId = 1, //This needs to be changed to constant class or something. 1 - Regular, 2 - Emergency' // SubmittedBy = user.FullName, // SubmittedDate = DateTime.Now, // SupplyChainUnitId = RRFServiceIntegration.BranchID, // OrderStatus = 1, // FormId = formid // }; // // order.OrderTypeId = (int)tblrrf.Rows[i]["RRfTpyeId"]; // // Set order properties // //order.FormId = rrfForm.Id; //Form.ID? or RRFForm.ID? - doesn't make sense // // order.ReportingPeriodId = periods[0].Id; //Asked again here? Because RRFForm already contains this. // var details = new Collection<OrderDetail>(); // foreach (DataRow rrfLine in tblRRF.Rows) // { // var detail = new PLITSTransactionalService.OrderDetail(); // var rrFormPharmaceutical = items.FirstOrDefault(x => x.ItemId == Convert.ToInt32(rrfLine["ID"])); // if (rrfLine != null && rrFormPharmaceutical != null) // //detail.Adjustments[0].Amount = (int)rrfLine["Adjustments"]; // { // detail.BeginningBalance = Convert.ToInt32(rrfLine["BeginingBalance"]); // //detail.DaysOutOfStocks = Convert.ToInt32(rrfLine["DaysOutOfStock"]); // detail.EndingBalance = Convert.ToInt32(rrfLine["SOH"]); // //detail.ItemId = Convert.ToInt32(rrfLine["ID"]); //Needs to come from the Code column of Items table. // detail.QuantityReceived = Convert.ToInt32(rrfLine["Received"]); // detail.QuantityOrdered = Convert.ToInt32(rrfLine["Quantity"]); // detail.LossAdjustment = Convert.ToInt32(rrfLine["LossAdj"]); // if (rrFormPharmaceutical != null) // detail.PharmaceuticalId = rrFormPharmaceutical.PharmaceuticalId; // // detail.PharmaceuticalId = Convert.ToInt32(rrfLine["ItemID"]); // // detail.PharmaceuticalId = pharId; // } // details.Add(detail); // } // order.OrderDetails = details; // orders.Add(order); //} //// loop through each record and create order & order details objects //return orders; }
public Conditioner(string name, bool state, Adjustment temperatureMode, bool humidifier) : base(name, state, temperatureMode) { this.humidifier = humidifier; }
/// <summary> /// PPP 计算核心方法。 Kalmam滤波。 /// 观测量的顺序是先伪距观测量,后载波观测量,观测量的总数为卫星数量的两倍。 /// 参数数量为卫星数量加5,卫星数量对应各个模糊度,5为3个位置量xyz,1个接收机钟差量,1个对流程湿分量。 /// </summary> /// <param name="mSiteEpochInfo">接收信息</param> /// <param name="lastResult">上次解算结果(用于 Kalman 滤波),若为null则使用初始值计算</param> /// <returns></returns> public override BaseGnssResult CaculateKalmanFilter(MultiSiteEpochInfo mSiteEpochInfo, BaseGnssResult lastResult = null) { //return base.CaculateKalmanFilter(mSiteEpochInfo, lastResult); var refEpoch = mSiteEpochInfo.BaseEpochInfo; var rovEpoch = mSiteEpochInfo.OtherEpochInfo; IonFreeDoubleDifferPositionResult last = null; if (lastResult != null) { last = (IonFreeDoubleDifferPositionResult)lastResult; } //双差必须观测到2颗以上卫星,否则返回空 if (refEpoch.EnabledPrns.Count < 2 && rovEpoch.EnabledPrns.Count < 2) { return(null); } //随机噪声模型合适否?????? //DualBandCycleSlipDetector.Dector(ref recInfo, ref currentRefInfo, CurrentBasePrn); //this.Adjustment = new KalmanFilter(MatrixBuilder); this.Adjustment = this.RunAdjuster(BuildAdjustObsMatrix(this.CurrentMaterial));// BuildAdjustObsMatrix(this.CurrentMaterial)); if (Adjustment.Estimated == null) { return(null); } this.Adjustment.ResultType = ResultType.Float; ////验后残差分析,探测是否漏的周跳或粗差 //bool isCS = ResidualsAnalysis.Detect(ref refEpoch, ref rovEpoch, Adjustment, CurrentBasePrn); //while (isCS) //{ // if (refEpoch.EnabledSatCount > 4) //1个基准星+n // { // this.MatrixBuilder = new IonFreeDoubleDifferMatrixBuilder(Option, BaseParamCount); // // this.MatrixBuilder.SetEpochInfo(recInfo).SetPreviousResult(lastPppResult); // this.CurrentMaterial.BaseEpochInfo = refEpoch; // this.CurrentMaterial.OtherEpochInfo = rovEpoch; // this.MatrixBuilder.SetMaterial(this.CurrentMaterial).SetPreviousProduct(this.CurrentProduct); // this.MatrixBuilder.SetBasePrn(this.CurrentBasePrn); // this.MatrixBuilder.Build(); // //this.Adjustment = new KalmanFilter(MatrixBuilder); // //this.Adjustment = new SimpleKalmanFilterOld(MatrixBuilder); // //this.Adjustment.Process(); // this.Adjustment = this.RunAdjuster(BuildAdjustObsMatrix(this.CurrentMaterial)); // if (Adjustment.Estimated == null) // { // return null; // } // isCS = ResidualsAnalysis.Detect(ref refEpoch, ref rovEpoch, Adjustment, CurrentBasePrn); // } // else // { isCS = false; } //} //模糊度固定解 if (Option.IsFixingAmbiguity) { //尝试固定模糊度 lock (locker) { //尝试固定模糊度 var fixIonFreeAmbiCycles = DoubleIonFreeAmReslution.Process(rovEpoch, refEpoch, Adjustment, CurrentBasePrn); //是否保存固定的双差LC模糊度信息,继承已固定的? 建议不用, 始终动态更新 // 对过去已固定,但当前历元却没有固定,是否继承下来?根据是否发生基准星变化、周跳等信息判断 WeightedVector preFixedVec = new WeightedVector(); //上一次固定结果,这里好像没有用,//2018.07.31, czs //作为约束条件,重新进行平差计算 if (fixIonFreeAmbiCycles != null && fixIonFreeAmbiCycles.Count > 0)// { fixIonFreeAmbiCycles.InverseWeight = new Matrix(new DiagonalMatrix(fixIonFreeAmbiCycles.Count, 1e-10)); WeightedVector NewEstimated = Adjustment.SolveAmbiFixedResult(fixIonFreeAmbiCycles, preFixedVec, Option.IsFixParamByConditionOrHugeWeight); XYZ newXYZ = new XYZ(NewEstimated[0], NewEstimated[1], NewEstimated[2]); XYZ oldXYZ = new XYZ(Adjustment.Estimated[0], Adjustment.Estimated[1], Adjustment.Estimated[2]); //模糊度固定错误的判断准则(参考李盼论文) if ((newXYZ - oldXYZ).Length > 0.05 && newXYZ.Length / oldXYZ.Length > 1.5) { //模糊度固定失败,则不用 } else { int nx = Adjustment.Estimated.Count; //nx = 3; for (int i = 0; i < nx; i++) { Adjustment.Estimated[i] = NewEstimated[i]; // for (int j = 0; j < nx ; j++) adjustment.Estimated.InverseWeight[i, j] = Estimated.InverseWeight[i, j]; } } } this.Adjustment.ResultType = ResultType.Fixed; //替换固定的模糊度参数,重新平差,依然不对啊 #region 参考Ge论文给的Blewitt 1989论文思路 //if (fixIonFreeAmbiCycles.Count > 1) //{ // Vector newAprioriParam = this.MatrixBuilder.AprioriParam; // IMatrix newAprioriParamCovInverse = this.MatrixBuilder.AprioriParam.InverseWeight.Inversion; // for (int i = 0; i < fixIonFreeAmbiCycles.Count; i++) // { // //对所有的参数 // var name = fixIonFreeAmbiCycles.ParamNames[i]; // int j = this.MatrixBuilder.ParamNames.IndexOf(name); // newAprioriParam[j] = fixIonFreeAmbiCycles[i]; // newAprioriParamCovInverse[j, j] = 1e28; // } // IMatrix TransferMatrix = MatrixBuilder.Transfer; // IMatrix AprioriParam = new Matrix(newAprioriParam); // IMatrix CovaOfAprioriParam = newAprioriParamCovInverse.GetInverse(); // IMatrix InverseWeightOfTransfer = MatrixBuilder.Transfer.InverseWeight; // IMatrix PredictParam = TransferMatrix.Multiply(AprioriParam);//.Plus(controlMatrix.Multiply(controlInputVector)); // IMatrix CovaOfPredictParam1 = AdjustmentUtil.BQBT(TransferMatrix, CovaOfAprioriParam).Plus(InverseWeightOfTransfer); // //简化字母表示 // Matrix Q1 = new Matrix(CovaOfPredictParam1); // Matrix P1 = new Matrix(CovaOfPredictParam1.GetInverse()); // Matrix X1 = new Matrix(PredictParam); // Matrix L = new Matrix(MatrixBuilder.Observation.Array); // Matrix A = new Matrix(MatrixBuilder.Coefficient); // Matrix AT = new Matrix(A.Transposition); // Matrix Po = new Matrix(MatrixBuilder.Observation.InverseWeight.GetInverse()); // Matrix Qo = new Matrix(MatrixBuilder.Observation.InverseWeight); // Matrix ATPA = new Matrix(AdjustmentUtil.ATPA(A, Po)); // //平差值Xk的权阵 // Matrix PXk = null; // if (Po.IsDiagonal) { PXk = ATPA + P1; } // else { PXk = AT * Po * A + P1; } // //计算平差值的权逆阵 // Matrix Qx = PXk.Inversion; // Matrix J = Qx * AT * Po; // //计算平差值 // Matrix Vk1 = A * X1 - L;//计算新息向量 // Matrix X = X1 - J * Vk1; // var Estimated = new WeightedVector(X, Qx) { ParamNames = MatrixBuilder.Observation.ParamNames }; // WeightedVector NewAdjustment = Estimated; // int nx = Adjustment.Estimated.Count; // for (int i = 0; i < nx; i++) // { // Adjustment.Estimated[i] = NewAdjustment[i]; // // for (int j = 0; j < nx ; j++) adjustment.Estimated.InverseWeight[i, j] = Estimated.InverseWeight[i, j]; // } //} #endregion //替换固定的模糊度参数,重新平差,依然不对啊 #region 参考Dong 1989论文方法 //if (fixIonFreeAmbiCycles.Count > 0) //{ // WeightedVector estIonFreeAmbiVector = this.Adjustment.Estimated.GetWeightedVector(fixIonFreeAmbiCycles.ParamNames); // List<string> paramNames = new List<string>(); // foreach (var item in this.Adjustment.Estimated.ParamNames) // { // if (!fixIonFreeAmbiCycles.ParamNames.Contains(item)) // { // paramNames.Add(item); // } // } // foreach (var item in fixIonFreeAmbiCycles.ParamNames) paramNames.Add(item); // var Estimate = this.Adjustment.Estimated; // var orderEstimate = Estimate.SortByName(paramNames); // Matrix order = new Matrix(paramNames.Count, paramNames.Count); // for(int i=0;i<paramNames.Count;i++) // { // int j = Estimate.ParamNames.IndexOf(paramNames[i]); // order[i, j] = 1; // } // Matrix X1 = new Matrix(Estimate.Array); // Matrix QX1 = new Matrix(Estimate.InverseWeight); // Matrix newX1 = order * X1; // Matrix newX1Cov = order * QX1 * order.Transpose(); // int n1 = Estimate.ParamNames.Count - fixIonFreeAmbiCycles.Count; // Matrix Q12 = newX1Cov.GetSub(0, n1, n1, fixIonFreeAmbiCycles.Count); // Matrix Q22 = newX1Cov.GetSub(n1, n1, fixIonFreeAmbiCycles.Count, fixIonFreeAmbiCycles.Count); // Matrix detX2 = new Matrix(fixIonFreeAmbiCycles.Count,1); // for(int i=0;i<fixIonFreeAmbiCycles.Count;i++) // { // int j = Estimate.ParamNames.IndexOf(fixIonFreeAmbiCycles.ParamNames[i]); // detX2[i, 0] = fixIonFreeAmbiCycles[i] - Estimate.Data[j]; // } // Matrix X = Q12 * Q22.Inversion * detX2; // Vector newX = new Vector(); // for (int i = 0; i < X.RowCount; i++) newX.Add(X[i, 0], paramNames[i]); // for (int i = 0; i < fixIonFreeAmbiCycles.Count; i++) newX.Add(detX2[i,0], fixIonFreeAmbiCycles.ParamNames[i]); // WeightedVector newEstrimate = new WeightedVector(newX); // newEstrimate.ParamNames = paramNames; // int nx = Adjustment.Estimated.Count; // for (int i = 0; i < 3; i++) // { // int j = newEstrimate.ParamNames.IndexOf(Adjustment.Estimated.ParamNames[i]); // Adjustment.Estimated[i] += newEstrimate[j]; // // for (int j = 0; j < nx ; j++) adjustment.Estimated.InverseWeight[i, j] = Estimated.InverseWeight[i, j]; // } //} #endregion } } if (Adjustment.Estimated != null) { var DDResidualDifferPositionResult = BuildResult(); //if (Option.PositionType == PositionType.动态定位) //{ // mSiteEpochInfo.OtherEpochInfo.SiteInfo.EstimatedXyz = ((IonFreeDoubleDifferPositionResult)DDResidualDifferPositionResult).EstimatedXyzOfRov; //} //double[] v = PppResidualDifferPositionResult.Adjustment.PostfitResidual.OneDimArray; //int k = recInfo.EnabledPrns.IndexOf(CurrentBasePrn); //for (int i = 0; i < recInfo.EnabledSatCount; i++) //{ // SatelliteNumber prn = recInfo[i].Prn; // if (prn != CurrentBasePrn) // { // List<double> tmp = new List<double>(); // if (!posfit.ContainsKey(prn)) posfit.Add(prn, tmp); // if (i < k) // { // posfit[prn].Add(v[i + recInfo.EnabledSatCount - 1]); // } // else // { posfit[prn].Add(v[i - 1 + recInfo.EnabledSatCount - 1]); } // } //} // this.SetProduct(DDResidualDifferPositionResult); return(DDResidualDifferPositionResult); } else { return(null); } }
public Collection<Order> GetOrders() { var orders = new Collection<Order>(); _tblRrf = (DataTable)gridItemsChoice.DataSource; tblRRF = (DataTable)gridItemsChoice.DataSource; var info = new GeneralInfo(); info.LoadAll(); var client1 = new ServiceRRFLookupClient(); var req = new GetCurrentReportingPeriodRequest { Password = RRFServiceIntegration.PlitsPassword, UserName = RRFServiceIntegration.PlitsUserName, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var branchReq = new GetBranchRRFormRequest { UserName = RRFServiceIntegration.PlitsUserName, Password = RRFServiceIntegration.PlitsPassword, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var formReq = new GetFormsRequest { Password = RRFServiceIntegration.PlitsPassword, UserName = RRFServiceIntegration.PlitsUserName, Supplychainunitid = RRFServiceIntegration.GetBranchID() }; var forms = client1.GetForms(formReq).GetFormsResult; var formid = forms[0].Id; var periods = client1.GetCurrentReportingPeriod(req).GetCurrentReportingPeriodResult; var period = periods[0].Id; branchReq.Formid = formid; branchReq.Reportingperiodid = period; var chosenCatId = 91;//RRFHelper.GetRrfCategoryId(cboStores.Text); var rrfs = client1.GetBranchRRForm(branchReq).GetBranchRRFormResult; var formCategories = rrfs.First().FormCategories; var chosenCategoryBody = formCategories.First(x => x.Id == chosenCatId); //Hard coding to be removed. var items = chosenCategoryBody.Pharmaceuticals; //Let's just store the items here (May not be required) var user = new User(); user.LoadByPrimaryKey(CurrentContext.LoggedInUser.ID); var order = new HCMIS.Desktop.PLITSTransactionalService.Order { //Id = (int)rrf["Id"], RequestCompletedDate = BLL.DateTimeHelper.ServerDateTime,//Convert.ToDateTime(rrf["DateOfSubmissionEth"]), OrderCompletedBy = user.FullName, RequestVerifiedDate = BLL.DateTimeHelper.ServerDateTime, OrderTypeId = 1, //This needs to be changed to constant class or something. 1 - Regular, 2 - Emergency' SubmittedBy = user.FullName, SubmittedDate = BLL.DateTimeHelper.ServerDateTime, SupplyChainUnitId = Helpers.RRFServiceIntegration.GetBranchID(), OrderStatus = 1,//TODO: hardcoding FormId = formid,//TODO: hardcoding ReportingPeriodId = period //TODO: hardcoding }; // order.OrderTypeId = (int)tblrrf.Rows[i]["RRfTpyeId"]; // Set order properties //order.FormId = rrfForm.Id; //Form.ID? or RRFForm.ID? - doesn't make sense // order.ReportingPeriodId = periods[0].Id; //Asked again here? Because RRFForm already contains this. var details = new Collection<OrderDetail>(); int i = 0; var xx = tblRRF.Rows.Count; foreach (DataRow rrfLine in tblRRF.Rows) { var detail = new PLITSTransactionalService.OrderDetail(); var hcmisItemID = Convert.ToInt32(rrfLine["ID"]); var rrFormPharmaceutical = items.FirstOrDefault(x => x.PharmaceuticalId == Convert.ToInt32(rrfLine["ID"])); if (rrfLine != null && rrFormPharmaceutical!=null) { detail.BeginningBalance = Convert.ToInt32(rrfLine["BeginingBalance"]); //DaysOutOfStock daysOfStockOut = new DaysOutOfStock() { NumberOfDaysOutOfStock = 1 }; //detail.DaysOutOfStocks.Add(daysOfStockOut);//Convert.ToInt32(rrfLine["DaysOutOfStock"]); int eBalance = Convert.ToInt32(rrfLine["SOH"]); detail.EndingBalance = eBalance == 0 ? 1 : eBalance; //To make sure ending balance is not zero. //detail.ItemId = Convert.ToInt32(rrfLine["ID"]); //Needs to come from the Code column of Items table. detail.QuantityReceived = Convert.ToInt32(rrfLine["Received"]); detail.QuantityOrdered = Convert.ToInt32(rrfLine["Quantity"]); detail.LossAdjustment = Convert.ToInt32(rrfLine["LossAdj"]); if (rrFormPharmaceutical != null) detail.ItemId = rrFormPharmaceutical.ItemId; else throw new Exception("Item ID Mismatch"); var rdDoc = new ReceiveDoc(); var lossAndAdjustment = new LossAndAdjustment(); rdDoc.GetAllWithQuantityLeft(hcmisItemID, _storeID); lossAndAdjustment.GetLossAdjustmentsForLastRRFPeriod(hcmisItemID, _storeID, periods[0].StartDate, periods[0].EndDate); int receiveDocEntries = rdDoc.RowCount; int disposalEntries = lossAndAdjustment.RowCount; rdDoc.Rewind(); for (var j = 0; j < receiveDocEntries; j++) { var exp = new Expiry { Amount = Convert.ToInt32(rdDoc.QuantityLeft), BatchNo = rdDoc.BatchNo, ExpiryDate = rdDoc.ExpDate }; detail.Expiries.Add(exp); rdDoc.MoveNext(); } lossAndAdjustment.Rewind(); for (var j = 0; j < disposalEntries; j++) { var adj = new Adjustment {Amount = Convert.ToInt32(lossAndAdjustment.Quantity), TypeId = 11, ReasonId = 39}; detail.Adjustments.Add(adj); lossAndAdjustment.MoveNext(); } var stockoutIndexedLists = StockoutIndexBuilder.Builder.GetStockOutHistory(hcmisItemID, _storeID); for (int j = 0; j < stockoutIndexedLists.Count; j++) { var dos = new DaysOutOfStock { NumberOfDaysOutOfStock = stockoutIndexedLists[j].NumberOfDays, StockOutReasonId = 5 }; detail.DaysOutOfStocks.Add(dos); } details.Add(detail); } } order.OrderDetails = details; orders.Add(order); // loop through each record and create order & order details objects return orders; //var user = new User(); //user.LoadByPrimaryKey(NewMainWindow.LoggedInUser.ID); //foreach (DataRow rrf in tblRRF.Rows) //{ // var order = new HCMIS.Desktop.PLITSTransactionalService.Order // { // Id = (int)rrf["Id"], // RequestCompletedDate = DateTime.Now,//Convert.ToDateTime(rrf["DateOfSubmissionEth"]), // OrderCompletedBy = user.FullName, // RequestVerifiedDate = DateTime.Now, // OrderTypeId = 1, //This needs to be changed to constant class or something. 1 - Regular, 2 - Emergency' // SubmittedBy = user.FullName, // SubmittedDate = DateTime.Now, // SupplyChainUnitId = RRFServiceIntegration.BranchID, // OrderStatus = 1, // FormId = formid // }; // // order.OrderTypeId = (int)tblrrf.Rows[i]["RRfTpyeId"]; // // Set order properties // //order.FormId = rrfForm.Id; //Form.ID? or RRFForm.ID? - doesn't make sense // // order.ReportingPeriodId = periods[0].Id; //Asked again here? Because RRFForm already contains this. // var details = new Collection<OrderDetail>(); // foreach (DataRow rrfLine in tblRRF.Rows) // { // var detail = new PLITSTransactionalService.OrderDetail(); // var rrFormPharmaceutical = items.FirstOrDefault(x => x.ItemId == Convert.ToInt32(rrfLine["ID"])); // if (rrfLine != null && rrFormPharmaceutical != null) // //detail.Adjustments[0].Amount = (int)rrfLine["Adjustments"]; // { // detail.BeginningBalance = Convert.ToInt32(rrfLine["BeginingBalance"]); // //detail.DaysOutOfStocks = Convert.ToInt32(rrfLine["DaysOutOfStock"]); // detail.EndingBalance = Convert.ToInt32(rrfLine["SOH"]); // //detail.ItemId = Convert.ToInt32(rrfLine["ID"]); //Needs to come from the Code column of Items table. // detail.QuantityReceived = Convert.ToInt32(rrfLine["Received"]); // detail.QuantityOrdered = Convert.ToInt32(rrfLine["Quantity"]); // detail.LossAdjustment = Convert.ToInt32(rrfLine["LossAdj"]); // if (rrFormPharmaceutical != null) // detail.PharmaceuticalId = rrFormPharmaceutical.PharmaceuticalId; // // detail.PharmaceuticalId = Convert.ToInt32(rrfLine["ItemID"]); // // detail.PharmaceuticalId = pharId; // } // details.Add(detail); // } // order.OrderDetails = details; // orders.Add(order); //} //// loop through each record and create order & order details objects //return orders; }
public Sauna(string name, bool state, Adjustment temperatureMode, Adjustment brightness) : base(name, state, temperatureMode) { this.brightness = brightness; }
public List<Order> GetStandardRRFOrders() { var client = new ServiceRRFLookupClient(); var orders = new List<Order>(); var ginfo = new GeneralInfo(); ginfo.LoadAll(); var dataView = gridItemChoiceView.DataSource as DataView; if (dataView != null) { dataView.RowFilter = gridItemChoiceView.ActiveFilterString; tblRRF = dataView.ToTable(); } var periods = client.GetCurrentReportingPeriod(ginfo.FacilityID, ginfo.ScmsWSUserName, ginfo.ScmsWSPassword); var form = client.GetForms(ginfo.FacilityID, ginfo.ScmsWSUserName, ginfo.ScmsWSPassword); var rrfs = client.GetFacilityRRForm(ginfo.FacilityID, form[0].Id, periods[0].Id, 1, ginfo.ScmsWSUserName, ginfo.ScmsWSPassword); var formCategories = rrfs.First().FormCategories; var chosenCategoryBody = formCategories.First(x => x.Id == 1); //TODO:Hard coding to be removed. var items = chosenCategoryBody.Pharmaceuticals; var user = new User(); user.LoadByPrimaryKey(MainWindow.LoggedinId); var order = new Order { RequestCompletedDate = DateTime.Now, OrderCompletedBy = user.FullName, RequestVerifiedDate = DateTime.Now, OrderTypeId = STANDARD_ORDER, SubmittedBy = user.FullName, SubmittedDate = DateTime.Now, SupplyChainUnitId = ginfo.FacilityID, OrderStatus = 1, //TODO: hardcoding FormId = form[0].Id, //TODO: hardcoding ReportingPeriodId = periods[0].Id //TODO: hardcoding }; var details = new List<RRFTransactionService.OrderDetail>(); foreach (DataRow rrfLine in tblRRF.Rows) { var detail = new RRFTransactionService.OrderDetail(); var hcmisItemID = Convert.ToInt32(rrfLine["DSItemID"]); var rrFormPharmaceutical = items.SingleOrDefault(x => x.PharmaceuticalId == hcmisItemID); if (rrFormPharmaceutical != null && Convert.ToString(rrfLine["Status"]) != "Below EOP") { detail.BeginningBalance = Convert.ToInt32(rrfLine["BeginingBalance"]); detail.EndingBalance = Convert.ToInt32(rrfLine["SOH"]); detail.QuantityReceived = Convert.ToInt32(rrfLine["Received"]); detail.QuantityOrdered = Convert.ToInt32(rrfLine["Quantity"]); detail.LossAdjustment = Convert.ToInt32(rrfLine["LossAdj"]); detail.ItemId = rrFormPharmaceutical.ItemId; var rdDoc = new ReceiveDoc(); var disposal = new Disposal(); rdDoc.GetAllWithQuantityLeft(hcmisItemID, _storeID); disposal.GetLossAdjustmentsForLastRrfPeriod(hcmisItemID, _storeID, periods[0].StartDate, periods[0].EndDate); int receiveDocEntries = rdDoc.RowCount; int disposalEntries = disposal.RowCount; if (rdDoc.RowCount == 0 && detail.EndingBalance == 0) detail.Expiries = null; detail.Expiries = new Expiry[receiveDocEntries]; detail.Adjustments = new Adjustment[disposalEntries]; rdDoc.Rewind(); int expiryAmountTotal = 0; for (int j = 0; j < receiveDocEntries; j++) { var exp = new Expiry { Amount = Convert.ToInt32(rdDoc.QuantityLeft) }; expiryAmountTotal += exp.Amount; exp.BatchNo = rdDoc.BatchNo; exp.ExpiryDate = rdDoc.ExpDate; if(exp.ExpiryDate > periods[0].EndDate.AddDays(ExpiryTreshHold)) exp.Amount = Convert.ToInt32(rdDoc.QuantityLeft); exp.ExpiryDate = periods[0].EndDate; detail.Expiries[j] = exp; rdDoc.MoveNext(); } disposal.Rewind(); int lossadjamt = 0; for (int j = 0; j < disposalEntries; j++) { var adj = new Adjustment { Amount = Convert.ToInt32(disposal.Quantity), TypeId = 1, ReasonId = 1 }; lossadjamt += adj.Amount; if (lossadjamt >= detail.LossAdjustment) detail.LossAdjustment = lossadjamt; detail.Adjustments[j] = adj; disposal.MoveNext(); } var stockoutIndexedLists = StockoutIndexBuilder.Builder.GetStockOutHistory(hcmisItemID, _storeID); var DOSPerStockOut = stockoutIndexedLists.Count(); detail.DaysOutOfStocks = new DaysOutOfStock[stockoutIndexedLists.Count()]; for (int j = 0; j < stockoutIndexedLists.Count(); j++) { var dos = new DaysOutOfStock { NumberOfDaysOutOfStock = 5, StockOutReasonId = 5 }; detail.DaysOutOfStocks[j] = dos; } } else if(rrFormPharmaceutical != null && Convert.ToString(rrfLine["Status"]) == "Below EOP") { detail.BeginningBalance = null; detail.EndingBalance = null; detail.QuantityReceived = null; detail.QuantityOrdered = null; detail.LossAdjustment = null; detail.ItemId = rrFormPharmaceutical.ItemId; var rdDoc = new ReceiveDoc(); var disposal = new Disposal(); rdDoc.GetAllWithQuantityLeft(hcmisItemID, _storeID); disposal.GetLossAdjustmentsForLastRrfPeriod(hcmisItemID, _storeID, periods[0].StartDate,periods[0].EndDate); int receiveDocEntries = rdDoc.RowCount; int disposalEntries = disposal.RowCount; if (rdDoc.RowCount == 0 && detail.EndingBalance == 0) detail.Expiries = null; detail.Expiries = new Expiry[receiveDocEntries]; detail.Adjustments = new Adjustment[disposalEntries]; rdDoc.Rewind(); int expiryAmountTotal = 0; for (int j = 0; j < receiveDocEntries; j++) { var exp = new Expiry {Amount = Convert.ToInt32(rdDoc.QuantityLeft)}; expiryAmountTotal += exp.Amount; exp.BatchNo = rdDoc.BatchNo; exp.ExpiryDate = rdDoc.ExpDate; if (expiryAmountTotal >= detail.EndingBalance) if (detail.EndingBalance != null) exp.Amount = exp.Amount - (expiryAmountTotal - detail.EndingBalance.Value); detail.Expiries[j] = null; rdDoc.MoveNext(); } disposal.Rewind(); int lossadjamt = 0; for (int j = 0; j < disposalEntries; j++) { var adj = new Adjustment { Amount = Convert.ToInt32(disposal.Quantity), TypeId = 11, ReasonId = 39 }; lossadjamt += adj.Amount; if (lossadjamt >= detail.LossAdjustment) detail.LossAdjustment = lossadjamt; detail.Adjustments[j] = null; disposal.MoveNext(); } var stockoutIndexedLists = StockoutIndexBuilder.Builder.GetStockOutHistory(hcmisItemID, _storeID); var DOSPerStockOut = stockoutIndexedLists.Count(); detail.DaysOutOfStocks = new DaysOutOfStock[stockoutIndexedLists.Count()]; for (int j = 0; j < stockoutIndexedLists.Count(); j++) { var dos = new DaysOutOfStock(); dos.NumberOfDaysOutOfStock = 5; dos.StockOutReasonId = 5; detail.DaysOutOfStocks[j] = null; } } details.Add(detail); } order.OrderDetails = details.ToArray(); orders.Add(order); // loop through each record and create order & order details objects return orders; }
public void addAdjustment(Adjustment adjustment) { inventory.Adjustment.Add(adjustment); inventory.SaveChanges(); }