private int Calc1(PPL a, List <PPL> ppl) { long time = (360 - a.degree) * a.minutes; int count = 0; foreach (var p in ppl) { int loop = 1; while ((360 * loop - p.degree) * p.minutes <= time) { ++loop; if (loop > ppl.Count + 10) { break; } } if (loop == 1) { ++count; } else if (loop > 2) { count += loop - 2; } } return(count); }
protected void btnDelete_Click(object sender, EventArgs e) { try { //string SqlQuery = ""; ////SqlQuery = "EXEC SPLOANGL @BRCD = '" + Session["BRCD"].ToString() + "', @LoanCode = '" + txtLoanCode.Text.ToString() + "', @LoanType = '" + txtLoanType.Text.ToString() + "', @Category = '" + ddlCategory.SelectedValue.ToString() + "', @IntType = '" + ddlIntType.SelectedValue.ToString() + "', @IntAmount = '" + txtIntAmount.Text.ToString() + "', " //// + " @LoanAmount = '" + txtLoanAmt.Text.ToString() + "', @RepName = '" + txtRepName.Text.ToString() + "', @IntRate = '" + txtIntRate.Text.ToString() + "', @Period = '" + txtPeriod.Text.ToString() + "', @acc1 = '" + TextBox1.Text.ToString() + "', @acc2 = '" + TextBox2.Text.ToString() + "', @acc3 = '" + TextBox3.Text.ToString() + "', " //// + " @acc4 ='" + TextBox4.Text.ToString() + "', @acc5 = '" + TextBox5.Text.ToString() + "', @acc6 = '" + TextBox6.Text.ToString() + "', @acc7 = '" + TextBox7.Text.ToString() + "', @acc8 = '" + TextBox8.Text.ToString() + "', @acc9 = '" + TextBox9.Text.ToString() + "', @Flag = '" + Request.QueryString["Flag"].ToString() + "'"; //int RM = conn.sExecuteQuery(SqlQuery); RM = LC.Insert_GL("LOANMASTER", "DL", Session["BRCD"].ToString(), txtLoanCode.Text, txtLoanType.Text, ddlCategory.SelectedValue, ddlIntType.SelectedValue, txtLoanAmt.Text, txtRepName.Text, txtIntRate.Text, txtPeriod.Text, TxtIRCode.Text, TxtPenCode.Text, TxtIRName.Text, TxtPenName.Text, PLACCNO.ToString(), "0", PGL.ToString(), PPL.ToString(), OTHCHG.ToString()); if (RM > 0) { lblMessage.Text = "Successfully Deleted..!"; ModalPopup.Show(this.Page); ClearData(Page.Controls); BindGrid(); } else { lblMessage.Text = "Unsuccesfull..!"; ModalPopup.Show(this.Page); ClearData(Page.Controls); BindGrid(); } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
// pa is slower private string Calc1(PPL pa, PPL pb) { if ((360 - pa.degree) * pa.minutes >= (720 - pb.degree) * pb.minutes) { return(1 + ""); } return(0 + ""); }