protected void btnSubscribe_Onclick(object sender, EventArgs e) { dtinfo.DateSeparator = "/"; dtinfo.ShortDatePattern = "dd/MM/yyyy"; FeeMaster fm = new FeeMaster(); string sto = fm.rtnlvl(lblSubscriptionFrom.Text); string sub = fm.rtnlvl(lblTo.Text); if (Convert.ToInt32(sub) <= Convert.ToInt32(sto)) { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand(); cmd = new SqlCommand("update Member set RenewDate=@RenewDate,ExpDate=@ExpDate, YearFrom=@YearFrom, YearTo=@YearTo where ID='" + lblID.Text.ToString() + "'", con); DateTime sd = new DateTime(); sd = Convert.ToDateTime(txtSubDate.Text.ToString(), dtinfo); sd = sd.AddMonths(12); cmd.Parameters.AddWithValue("@RenewDate", sd); sd = sd.AddMonths(6); cmd.Parameters.AddWithValue("@ExpDate", sd); cmd.Parameters.AddWithValue("@YearFrom", lblSubscriptionFrom.Text.ToString()); cmd.Parameters.AddWithValue("@YearTo", lblSubscriptionTo.Text.ToString()); cmd.ExecuteNonQuery(); imtrans(txtIMID.Text.ToString(), lblSubFee.Text.ToString(), "Subscription Fees", "Subscription"); amountupdate(txtIMID.Text.ToString(), Convert.ToInt32(lblSubFee.Text)); ClsAccount amount1 = new ClsAccount(); amount1.AmountSubmit(txtIMID.Text.ToString(), "", DateTime.Now, "Debit", lblSubFee.Text, lblSubscriptionFrom.Text.ToString(), "Subscription Fees"); con.Close(); con.Dispose(); } Response.Redirect(System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString()); }
public frmQLQCFcs(ClsAccount acc) { InitializeComponent(); this.LoginAccount = acc; LoadTypeDrink(); LoadTableDrink(); LoadComboBoxTable(cobLoadTable); }
async Task InsertClient(ClsClient client, ClsAccount account) { try { await apiCore.PostClient(client, account.IdCuenta, account.Balance, account.TipoCuenta); } catch (Exception ex) { await dialogService.DisplayAlertAsync("Error", $"{ex.Message}", "ok"); } }
//Tim kiem tai khoan public List <ClsAccount> timkiem(string name) { List <ClsAccount> list = new List <ClsAccount>(); DataTable data = DataProvider.Instance.ExcuteQuery("SELECT * FROM Account WHERE dbo.GetUnsignString(UserName) LIKE N'%' + dbo.GetUnsignString(N'" + name + "') + '%'"); foreach (DataRow item in data.Rows) { ClsAccount account = new ClsAccount(item); list.Add(account); } return(list); }
//lay danh sach tai khoan public List <ClsAccount> listAccount() { List <ClsAccount> list = new List <ClsAccount>(); DataTable data = DataProvider.Instance.ExcuteQuery("SP_Account"); foreach (DataRow item in data.Rows) { ClsAccount account = new ClsAccount(item); list.Add(account); } return(list); }
//Xử lý đăng nhập private void btnDangNhap_Click(object sender, EventArgs e) { //username Admin //password 1 string username = txtTendangnhap.Text; string password = txtMatkhau.Text; if (Logins(username, password)) { ClsAccount loginAccount = Login.Instance.getAccount(username); frmQLQCFcs frmQLCF = new frmQLQCFcs(loginAccount); this.Hide(); frmQLCF.ShowDialog(); this.Show(); txtMatkhau.Text = ""; } else { MessageBox.Show("Sai tài khoản hoặc mật khẩu\nVui lòng kiểm tra lại!"); } }
public async Task PutAccount(ClsAccount account) { var postRequest = RestService.For <IApiCore>(ConfigApi.ApiUrl); await postRequest.PutAccount(account); }
void typeAccount(ClsAccount acc) { txtTendangnhap.Text = loginAccount.Username; }
protected void btnSubscribe_Click(object sender, EventArgs e) { try { bool flag = false; con.Close(); con.Open(); dtinfo.DateSeparator = "/"; dtinfo.ShortDatePattern = "dd/MM/yyyy"; if (lblmemRcv.Text == "") { Label1.Text = "Please Select Diary."; } else { if (Convert.ToInt32(lblmemRcv.Text) > Convert.ToInt32(lblmemSub.Text)) { Label1.Text = ""; SqlCommand cmd2 = new SqlCommand(); cmd2 = new SqlCommand("select max(TransID) from MemberFee where ID='" + txtId.Text.ToString() + "'", con); string tid = Convert.ToString(cmd2.ExecuteScalar()); if (tid == "") { tid = "0"; } cmd2 = new SqlCommand("select TransType, Balance from MemberFee where ID='" + txtId.Text.ToString() + "' and TransID='" + Convert.ToInt32(tid.ToString()) + "'", con); SqlDataReader reader; string ttype = "", typ = ""; reader = cmd2.ExecuteReader(); while (reader.Read()) { ttype = reader["TransType"].ToString(); lblBalance.Text = reader["Balance"].ToString().TrimEnd('0').TrimEnd('.'); } reader.Close(); int bl, amt; if (lblBalance.Text == "") { bl = 0; } else { bl = Convert.ToInt32(lblBalance.Text); } amt = Convert.ToInt32(lblTAmt.Text); if (ttype == "Debit" && bl > amt) { typ = "Debit"; lblBalance.Text = (bl - amt).ToString(); } else if (ttype == "Debit" && bl <= amt) { typ = "Credit"; lblBalance.Text = (amt - bl).ToString(); } else if (ttype == "Credit") { typ = "Credit"; lblBalance.Text = (amt + bl).ToString(); } else if (ttype == "") { typ = "Credit"; } cmd2 = new SqlCommand("insert into MemberFee (MType, ID, Amt, FeeType, SubDate, SubType, AcountNo, DD, Bank, YearFrom, YearTo,TransType,Balance,TransID) values(@MType, @ID, @Amt, @FeeType, @SubDate, @SubType, @AcountNo, @DD, @Bank, @YearFrom, @YearTo, @TransType, @Balance,@TransID)", con); cmd2.Parameters.AddWithValue("@MType", lblMemberType.Text.ToString()); cmd2.Parameters.AddWithValue("@ID", txtId.Text.ToString()); cmd2.Parameters.AddWithValue("@Amt", lblTAmt.Text.ToString()); cmd2.Parameters.AddWithValue("@FeeType", txtNarration.Text.ToString()); cmd2.Parameters.AddWithValue("@SubDate", Convert.ToDateTime(txtDate.Text, dtinfo)); cmd2.Parameters.AddWithValue("@SubType", ddlAmtType.SelectedValue.ToString()); cmd2.Parameters.AddWithValue("@AcountNo", txtACNO.Text.ToString()); cmd2.Parameters.AddWithValue("@DD", txtDDNO.Text.ToString()); cmd2.Parameters.AddWithValue("@Bank", ddlBank.SelectedValue.ToString()); cmd2.Parameters.AddWithValue("@YearFrom", lblSessionHiddend.Text.ToString()); cmd2.Parameters.AddWithValue("@YearTo", ""); cmd2.Parameters.AddWithValue("@TransType", typ.ToString()); cmd2.Parameters.AddWithValue("@Balance", lblBalance.Text.ToString()); cmd2.Parameters.AddWithValue("@TransID", tid + 1); cmd2.ExecuteNonQuery(); ClsAccount cl = new ClsAccount(); //Account cl.AmountSubmit(txtId.Text.ToString(), GridDiaryNo.SelectedRow.Cells[1].Text.ToString(), Convert.ToDateTime(txtDate.Text, dtinfo), "Credit", lblTAmt.Text.ToString(), lblSessionHiddend.Text.ToString(), txtDDNO.Text.ToString() + ":" + ddlBank.SelectedValue.ToString()); //IMAC imac = new clsIMAC(); // Submit Amount in IMAccount imac.submitAmount(txtId.Text, Convert.ToInt32(txtAmt.Text), ddlAccountType.SelectedValue.ToString(), con); // amountupdate(txtId.Text.ToString(), Convert.ToInt32(lblTAmt.Text)); //FeeAC cmd = new SqlCommand("insert into FeeAC(IMID,Amt,AmtType,AmtFor,SubDate,DDNO,Bank,Narration,CurrancyName,CurrancyValue,Session,DiaryNo,DDDate) values(@IMID,@Amt,@AmtType,@AmtFor,@SubDate,@DDNO,@Bank,@Narration,@CurrancyName,@CurrancyValue,@Session,@DiaryNo,@DDDate)", con); cmd.Parameters.AddWithValue("@IMID", txtId.Text.ToString()); cmd.Parameters.AddWithValue("@Amt", txtAmt.Text); cmd.Parameters.AddWithValue("@AmtType", ddlAmtType.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@AmtFor", "Membership"); cmd.Parameters.AddWithValue("@SubDate", Convert.ToDateTime(txtDate.Text, dtinfo)); cmd.Parameters.AddWithValue("@DDNO", txtDDNO.Text.ToString()); cmd.Parameters.AddWithValue("@Bank", ddlBank.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@Narration", txtNarration.Text.ToString()); cmd.Parameters.AddWithValue("@CurrancyName", ddlCurrancy.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@CurrancyValue", txtCurrancyValue.Text); cmd.Parameters.AddWithValue("@Session", lblSessionHiddend.Text.ToString()); cmd.Parameters.AddWithValue("@DiaryNo", GridDiaryNo.SelectedRow.Cells[1].Text.ToString()); cmd.Parameters.AddWithValue("@DDDate", Convert.ToDateTime(txtDOB.Text, dtinfo)); cmd.ExecuteNonQuery(); updateCount(lblSessionHiddend.Text, extra.Text); countDD(lblSessionHiddend.Text, extra.Text); Log.WriteLog(Request.QueryString["maikal"], "B003", lblID.Text.ToString() + ":" + GridDiaryNo.SelectedRow.Cells[1].Text.ToString(), ddlBank.SelectedValue.ToString(), txtDDNO.Text.ToString(), lblTAmt.Text.ToString(), "Membership DD to Im Account"); Log.WriteLog("B003", Request.QueryString["maikal"], lblID.Text.ToString() + ":" + GridDiaryNo.SelectedRow.Cells[1].Text.ToString(), ddlBank.SelectedValue.ToString(), txtDDNO.Text.ToString(), lblTAmt.Text.ToString(), "Membership DD to Im Account"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Amount Successfully Submitted.')", true); flag = true; lblTAmt.Text = "0"; txtAmt.Text = ""; txtDDNO.Text = ""; txtDate.Text = ""; txtNarration.Text = ""; txtACNO.Text = ""; txtCurrancyValue.Text = "1"; ddlCurrancy.SelectedIndex = 0; } else { Label1.Text = "All DD submitted"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('All Membership DD Submitted.')", true); } } SqlDataAdapter ad = new SqlDataAdapter("select SubDate as Date,DD as DDNo,Bank,YearFrom as Session,Amt as Amount,TransType,Balance from MemberFee where ID='" + txtId.Text.ToString() + "' ORDER BY TransID DESC", con); DataTable dt = new DataTable(); ad.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); btnSubscribe.Enabled = false; con.Close(); con.Dispose(); } catch (FormatException ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Enter Details in Correct Format.')", true); } catch (SqlException ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Incorrect Data.')", true); } finally { btnSubscribe.Enabled = false; txtAmt.Text = ""; } }
public void imtrans(string imid, string amt, string feetype, string stype) { con.Close(); con.Open(); int tid; int bl, fee, dif = 0; string ttype; SqlCommand cmd2 = new SqlCommand(); try { cmd2 = new SqlCommand("select max(TransID) from MemberFee where ID='" + imid.ToString() + "'", con); tid = Convert.ToInt32(cmd2.ExecuteScalar()); if (tid == null) { bl = 0; tid = 0; ttype = "Credit"; } } catch (InvalidCastException ex) { bl = 0; tid = 0; ttype = "Credit"; } cmd2 = new SqlCommand("select TransType from MemberFee Where ID='" + imid.ToString() + "' and TransID='" + tid + "'", con); ttype = Convert.ToString(cmd2.ExecuteScalar()); if (ttype == "" && tid == 0) { ttype = "Credit"; } bl = Convert.ToInt32(lblBalance.Text); fee = Convert.ToInt32(amt); if (ttype == "Debit") { dif = fee + bl; ttype = "Debit"; } else if (ttype == "Credit") { if (bl >= fee) { dif = bl - fee; ttype = "Credit"; } else { dif = fee - bl; ttype = "Debit"; } } dtinfo.ShortDatePattern = "dd/MM/yyyy"; dtinfo.DateSeparator = "/"; tid += 1; cmd2 = new SqlCommand("insert into MemberFee (MType, ID, Amt, FeeType, SubDate, SubType, AcountNo, DD, Bank, YearFrom, YearTo,TransType,Balance,TransID) values(@MType, @ID, @Amt, @FeeType, @SubDate, @SubType, @AcountNo, @DD, @Bank, @YearFrom, @YearTo, @TransType, @Balance,@TransID)", con); cmd2.Parameters.AddWithValue("@MType", lblMemberTyep.Text.ToString()); cmd2.Parameters.AddWithValue("@ID", imid.ToString()); cmd2.Parameters.AddWithValue("@Amt", amt.ToString()); cmd2.Parameters.AddWithValue("@FeeType", feetype.ToString()); cmd2.Parameters.AddWithValue("@SubDate", Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy"), dtinfo)); cmd2.Parameters.AddWithValue("@SubType", stype.ToString()); cmd2.Parameters.AddWithValue("@AcountNo", "N/A"); cmd2.Parameters.AddWithValue("@DD", "N/A"); cmd2.Parameters.AddWithValue("@Bank", "N/A"); cmd2.Parameters.AddWithValue("@YearFrom", ddlSessionFrom.SelectedValue.ToString() + "" + txtYearFrom.Text.ToString()); cmd2.Parameters.AddWithValue("@YearTo", fmcls.nextSession(ddlSessionFrom.SelectedValue.ToString() + "" + txtYearFrom.Text.ToString())); cmd2.Parameters.AddWithValue("@TransType", ttype.ToString()); cmd2.Parameters.AddWithValue("@Balance", dif.ToString()); cmd2.Parameters.AddWithValue("@TransID", tid); cmd2.ExecuteNonQuery(); lblBalanceType.Text = ttype.ToString(); lblBalance.Text = dif.ToString(); ClsAccount cl = new ClsAccount(); cl.AmountSubmit(imid, "", DateTime.Now, "Debit", amt, lblSessionHiddend.Text.ToString(), feetype); con.Close(); }
protected void btnSubmitAmt_Click(object sender, EventArgs e) { dtinfo.DateSeparator = "/"; dtinfo.ShortDatePattern = "dd/MM/yyyy"; try { con.Close(); con.Open(); cmd = new SqlCommand(); SqlTransaction sTR; sTR = con.BeginTransaction(); cmd.Connection = con; cmd.Transaction = sTR; cmd.CommandText = "Select DDNO from FeeAC where DDNO='" + txtDDNO.Text.ToString() + "' and Bank='" + ddlBank.SelectedValue.ToString() + "' and DDDate='" + Convert.ToDateTime(txtDOB.Text, dtinfo) + "'"; string strddno = Convert.ToString(cmd.ExecuteScalar()); if (strddno == "") { if (Convert.ToInt32(lblTDDRcv.Text) > Convert.ToInt32(lblTDDSub.Text)) { if ((ddlAmountHeader.SelectedValue.ToString() == "Academic" || ddlAmountHeader.SelectedValue.ToString() == "AutoCAD") && (Convert.ToInt32(lblADDRcv.Text) == Convert.ToInt32(lblADDSub.Text))) { lblException.Text = "All DD Submitted"; ddlAmountHeader.Focus(); } else if (ddlAmountHeader.SelectedValue.ToString() == "Others" && (Convert.ToInt32(lblODDRcv.Text) == Convert.ToInt32(lblODDSub.Text))) { lblException.Text = "All DD Submitted"; ddlAmountHeader.Focus(); } else if (ddlAmountHeader.SelectedValue.ToString() == "Project" && (Convert.ToInt32(lblProRcv.Text) == Convert.ToInt32(lblProSub.Text))) { lblException.Text = "All DD Submitted"; ddlAmountHeader.Focus(); } else if (ddlAmountHeader.SelectedValue.ToString() == "Books" && (Convert.ToInt32(lblBookRcv.Text) == Convert.ToInt32(lblBookSub.Text))) { lblException.Text = "All DD Submitted"; ddlAmountHeader.Focus(); } else if (ddlAmountHeader.SelectedValue.ToString() == "Prospectus" && (Convert.ToInt32(lblProspectusRcv.Text) == Convert.ToInt32(lblProspectusSub.Text))) { lblException.Text = "All DD Submitted"; ddlAmountHeader.Focus(); } else { try { cmd.CommandText = "insert into FeeAC(IMID,Amt,AmtType,AmtFor,SubDate,DDNO,Bank,Narration,CurrancyName,CurrancyValue,Session,DiaryNo,DDDate) values(@IMID,@Amt,@AmtType,@AmtFor,@SubDate,@DDNO,@Bank,@Narration,@CurrancyName,@CurrancyValue,@Session,@DiaryNo,@DDDate)"; cmd.Parameters.AddWithValue("@IMID", lblEnrolment.Text.ToString()); cmd.Parameters.AddWithValue("@Amt", lblTAmt.Text); cmd.Parameters.AddWithValue("@AmtType", ddlAmtType.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@AmtFor", ddlAmountHeader.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@SubDate", DateTime.Now); cmd.Parameters.AddWithValue("@DDNO", txtDDNO.Text.ToString()); cmd.Parameters.AddWithValue("@Bank", ddlBank.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@Narration", txtNarration.Text.ToString()); cmd.Parameters.AddWithValue("@CurrancyName", ddlCurrancy.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@CurrancyValue", txtCurrancyValue.Text); cmd.Parameters.AddWithValue("@Session", lblhiddenSession.Text.ToString()); cmd.Parameters.AddWithValue("@DiaryNo", txtACNO.Text.ToString()); cmd.Parameters.AddWithValue("@DDDate", Convert.ToDateTime(txtDOB.Text, dtinfo)); cmd.ExecuteNonQuery(); //cmd.CommandText ="select * from IMAC where IMID='" + lblEnrolment.Text.ToString() + "'"; //SqlDataReader reader; ad = new int[5]; //reader = cmd.ExecuteReader(); //while (reader.Read()) //{ // ad[0] = Convert.ToInt32(reader["Late"]); //late // ad[1] = Convert.ToInt32(reader["Total"]); //total // // ad[2] = Convert.ToInt32(reader["GTotal"]); // Gtotal; // ad[2] = Convert.ToInt32(reader["IMTotal"]); // Books // ad[3] = Convert.ToInt32(reader["Prospectus"]); // Prospectus //} //reader.Close(); ad[1] = Convert.ToInt32(lblTAmt.Text); if (ddlAmountHeader.SelectedValue.ToString() == "Late Fees") { ad[0] = Convert.ToInt32(lblTAmt.Text); } else { ad[0] = 0; } if (ddlAmountHeader.SelectedValue.ToString() == "Books") { ad[2] = Convert.ToInt32(lblTAmt.Text); } else { ad[2] = 0; } if (ddlAmountHeader.SelectedValue.ToString() == "Prospectus") { ad[3] = Convert.ToInt32(lblTAmt.Text); } else { ad[3] = 0; } if (ddlAmountHeader.SelectedValue.ToString() == "Project") { ad[4] = Convert.ToInt32(lblTAmt.Text.ToString()); } else { ad[4] = 0; } cmd.CommandText = "Update IMAccount set Amount=Amount+'" + Convert.ToInt32(lblTAmt.Text) + "' where Fees='" + ddlAmountHeader.SelectedValue.ToString() + "' and IMID='" + lblEnrolment.Text.ToString() + "'"; cmd.ExecuteNonQuery(); //cmd.CommandText = "update IMAC set Late=Late+'" + ad[0] + "', Total=Total+'" + ad[1] + "', IMTotal=IMTotal+'" + ad[2] + "', Prospectus=Prospectus+'" + ad[3] + "' , Project=Project+'" + ad[3] + "' where IMID='" + lblEnrolment.Text.ToString() + "'"; //cmd.ExecuteNonQuery(); //icelate = Convert.ToInt32(lblTAmt.Text); //if (ddlAmountHeader.SelectedValue.ToString() != "Late Fees") //{ // icelate = 0; //} //cmd.CommandText = "update IMAC set Late=Late+'" + icelate + "', Total=Total+'" + Convert.ToInt32(lblTAmt.Text) + "' where IMID='ICE'"; //cmd.ExecuteNonQuery(); lblDiaryAmount.Text = (Convert.ToInt32(lblDiaryAmount.Text) + Convert.ToInt32(txtAmt.Text)).ToString(); ClsAccount ac = new ClsAccount(); ac.AmountSubmit(lblEnrolment.Text, txtACNO.Text, DateTime.Now, "Credit", lblTAmt.Text, lblhiddenSession.Text, txtDDNO.Text + ":" + ddlBank.SelectedItem.Text, sTR, cmd); updateCount(lblhiddenSession.Text.ToString(), txtACNO.Text.ToString(), sTR, cmd); Log.WriteLog(Request.QueryString["maikal"], "B002", txtIDIM.Text.ToString() + ":" + txtACNO.Text.ToString(), ddlBank.SelectedValue.ToString(), txtDDNO.Text.ToString(), lblTAmt.Text.ToString(), "Add DD to Im Account"); Log.WriteLog("B002", Request.QueryString["maikal"], txtIDIM.Text.ToString() + ":" + txtACNO.Text.ToString(), ddlBank.SelectedValue.ToString(), txtDDNO.Text.ToString(), lblTAmt.Text.ToString(), "Add DD to Im Account"); txtDDNO.Text = ""; txtNarration.Text = ""; txtAmt.Text = ""; lblTAmt.Text = "0"; lblExceptionCount.Text = ""; lblException.Text = ""; // total(txtIDIM.Text,sTR,cmd); sTR.Commit(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Sucessfully Submitted')", true); txtACNO.Focus(); } catch (Exception ex) { sTR.Rollback(); } } } else { lblExceptionCount.Text = "All DD Submitted."; btnClear.Focus(); } } else { lblException.Text = "Already Submitted This DD No.: " + txtDDNO.Text.ToString() + " In " + ddlBank.SelectedValue.ToString(); txtDDNO.Focus(); } } catch (SqlException ex) { lblException.Text = ex.ToString(); } catch (Exception ex) { lblException.Text = ex.ToString(); } finally { con.Close(); con.Dispose(); } }
protected void btnSubmitAmt_Click(object sender, EventArgs e) { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand(); SqlTransaction sTR; sTR = con.BeginTransaction(); cmd.Connection = con; int dif = 0; bool flag = false; cmd.Transaction = sTR; try { dtinfo.DateSeparator = "/"; dtinfo.ShortDatePattern = "dd/MM/yyyy"; ClsEdit clEdit = new ClsEdit(); clEdit.CountUp("DDEntry"); //cmd.CommandText = "select * from IMAC where IMID='"+txtIDIM.Text+"'"; //SqlDataReader read = cmd.ExecuteReader(); //while (read.Read()) //{ // tamt = Convert.ToInt32(read["Total"].ToString().TrimEnd('0').TrimEnd('.')); // gamt = Convert.ToInt32(read["GTotal"].ToString().TrimEnd('0').TrimEnd('.')); // dues = Convert.ToInt32(read["Credit"].ToString().TrimEnd('0').TrimEnd('.')); //} //read.Close(); int oamt = Convert.ToInt32(GridAppTable.SelectedRow.Cells[2].Text); int namt = Convert.ToInt32(txtAmt.Text); if (namt >= oamt) { dif = namt - oamt; lblDiaryAmount.Text = (Convert.ToInt32(lblDiaryAmount.Text) + dif).ToString(); flag = true; } else { dif = oamt - namt; lblDiaryAmount.Text = (Convert.ToInt32(lblDiaryAmount.Text) - dif).ToString(); flag = false; } cmd.CommandText = "select SN from Account where Session='" + ddlsession.SelectedValue + txtSession.Text + "' and IMID='" + txtIDIM.Text + "' and DiaryNo='" + GridAppTable.SelectedRow.Cells[1].Text.ToString() + "' and Details='" + GridAppTable.SelectedRow.Cells[3].Text.ToString() + ":" + GridAppTable.SelectedRow.Cells[5].Text.ToString() + "'"; int Sn = Convert.ToInt32(cmd.ExecuteScalar()); ClsAccount c2 = new ClsAccount(); c2.AmountUpdate(Sn, txtAmt.Text, cmd, ddlBank.SelectedItem.Text, txtDDNO.Text); //ClsAccount cl = new ClsAccount(); //cl.AmountSubmit(txtIDIM.Text.ToString(), txtDiaryNo.Text.ToString(), Convert.ToDateTime(txtDOB.Text, dtinfo), type, amt.ToString(), lblhiddenSession.Text.ToString(), "DD Edit",sTR,cmd); cmd.CommandText = "Update DiaryEntry set Amount='" + lblDiaryAmount.Text + "' where DiaryNo='" + txtDiaryNo.Text.ToString() + "'"; cmd.ExecuteNonQuery(); cmd.CommandText = "update FeeAC set IMID=@IMID,Amt=@Amt,AmtType=@AmtType,AmtFor=@AmtFor,SubDate=@SubDate,DDDate=@DDDate,DDNO=@DDNO,Bank=@Bank,Narration=@Narration,Session=@Session,DiaryNo=@DiaryNo where DDNO='" + GridAppTable.SelectedRow.Cells[3].Text.ToString() + "' and IMID='" + txtIDIM.Text + "' and DiaryNo='" + txtDiaryNo.Text + "'"; cmd.Parameters.AddWithValue("@IMID", lblEnrolment.Text.ToString()); cmd.Parameters.AddWithValue("@Amt", namt.ToString()); cmd.Parameters.AddWithValue("@AmtType", ddlAmtType.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@AmtFor", ddlAmtForMs.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@SubDate", Convert.ToDateTime(txtDate.Text, dtinfo)); cmd.Parameters.AddWithValue("@DDDate", Convert.ToDateTime(txtDOB.Text, dtinfo)); cmd.Parameters.AddWithValue("@DDNO", txtDDNO.Text.ToString()); cmd.Parameters.AddWithValue("@Bank", ddlBank.SelectedItem.Text); cmd.Parameters.AddWithValue("@Narration", txtNarration.Text.ToString()); cmd.Parameters.AddWithValue("@Session", lblhiddenSession.Text.ToString()); cmd.Parameters.AddWithValue("@DiaryNo", txtDiaryNo.Text.ToString()); cmd.ExecuteNonQuery(); cmd.CommandText = "Update IMAccount set Amount=Amount-'" + oamt + "' where IMID='" + lblEnrolment.Text + "' and Fees='" + GridAppTable.SelectedRow.Cells[8].Text.ToString() + "'"; cmd.ExecuteNonQuery(); cmd.CommandText = "Update IMAccount set Amount=Amount+'" + namt + "' where IMID='" + lblEnrolment.Text + "' and Fees='" + ddlAmtForMs.SelectedValue.ToString() + "'"; cmd.ExecuteNonQuery(); //cmd.CommandText = "update IMAC set Total='" + tamt.ToString() + "',Gtotal='" + gamt.ToString() + "',Credit='" + dues.ToString() + "' where IMID='" + txtIDIM.Text + "'"; //cmd.ExecuteNonQuery(); sTR.Commit(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Sucessfully Submitted')", true); lblException.Text = lblTAmt.Text.ToString() + " Rs. is saved in IM: " + lblEnrolment.Text.ToString(); string[] stredit = clEdit.EditCount("DDEntry"); lblEditCount.Text = stredit[0].ToString(); if (stredit[1] == "False") { pnlEdit.Enabled = false; } else { pnlEdit.Enabled = true; } } catch (SqlException ex) { sTR.Rollback(); lblException.Text = ex.ToString(); } catch (Exception ex) { lblException.Text = ex.ToString(); } finally { View(); con.Close(); con.Dispose(); txtDDNO.Text = ""; txtNarration.Text = ""; txtAmt.Text = ""; } btnSubmitAmt.Enabled = false; lblEdit.Visible = true; }
protected void btnSAve_Onclick(object sender, EventArgs e) { try { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand(); int x = 0, y = 0, w = 0; string v = ""; int amount = Convert.ToInt32(txtRefund.Text); string str = "select IMID,Total,Credit,GID,GTotal from IMAC where IMID='" + lblEnrolment.Text.ToString() + "' "; cmd = new SqlCommand(str, con); SqlDataReader rd = cmd.ExecuteReader(); if (rd.Read()) { x = Convert.ToInt32(rd["Credit"]); y = Convert.ToInt32(rd["LateFeeTaken"]); w = Convert.ToInt32(rd["GTotal"]); v = (rd["GID"]).ToString(); w = w - x - y; } rd.Close(); string str1 = "update IMAC set Total=@imactotal,Credit=@credit where IMID='" + lblEnrolment.Text + "'"; cmd = new SqlCommand(str1, con); cmd.Parameters.AddWithValue("@imactotal", 0); cmd.Parameters.AddWithValue("@credit", 0); cmd.ExecuteNonQuery(); string str2 = "update IMAC set GTotal=@gtotal where GID='" + v + "'"; cmd = new SqlCommand(str2, con); cmd.Parameters.AddWithValue("@gtotal", w); cmd.ExecuteNonQuery(); maikal dev = new maikal(); int se = dev.chksession(); string session; if (se == 0) { session = "Sum"; } else { session = "Win"; } session = session + DateTime.Now.Year.ToString(); ClsAccount cl = new ClsAccount(); cl.AmountSubmit(lblEnrolment.Text.ToString(), "", DateTime.Now, "Debit", lblToAmt.Text.ToString(), session.ToString(), "Membership ReFund"); cmd = new SqlCommand("select max(TransID) from MemberFee where ID='" + lblEnrolment.Text.ToString() + "'", con); string tid = Convert.ToString(cmd.ExecuteScalar()); cmd = new SqlCommand("insert into MemberFee (MType, ID, Amt, FeeType, SubDate, SubType, AcountNo, DD, Bank, YearFrom, YearTo,TransType,Balance,TransID) values(@MType, @ID, @Amt, @FeeType, @SubDate, @SubType, @AcountNo, @DD, @Bank, @YearFrom, @YearTo, @TransType, @Balance,@TransID)", con); cmd.Parameters.AddWithValue("@MType", "IM"); cmd.Parameters.AddWithValue("@ID", lblEnrolment.Text.ToString()); cmd.Parameters.AddWithValue("@Amt", txtRefund.Text); cmd.Parameters.AddWithValue("@FeeType", "Membership ReFund"); cmd.Parameters.AddWithValue("@SubDate", Convert.ToDateTime(DateTime.Now, dtinfo)); cmd.Parameters.AddWithValue("@SubType", "N/A"); cmd.Parameters.AddWithValue("@AcountNo", "N/A"); cmd.Parameters.AddWithValue("@DD", "N/A"); cmd.Parameters.AddWithValue("@Bank", "N/A"); cmd.Parameters.AddWithValue("@YearFrom", session); cmd.Parameters.AddWithValue("@YearTo", ""); cmd.Parameters.AddWithValue("@TransType", "Credit"); cmd.Parameters.AddWithValue("@Balance", 0); cmd.Parameters.AddWithValue("@TransID", tid + 1); cmd.ExecuteNonQuery(); cmd = new SqlCommand("update IMInspection set Status=@Status,Refund=@Refund,TotalAmount=@TotalAmount where ID='" + lblEnrolment.Text.ToString() + "' and SN='" + GridView2.SelectedRow.Cells[1].Text.ToString() + "'", con); cmd.Parameters.AddWithValue("@Status", "ReFund"); cmd.Parameters.AddWithValue("@Refund", txtRefund.Text.ToString()); cmd.Parameters.AddWithValue("@TotalAmount", lblToAmt.Text.ToString()); cmd.ExecuteNonQuery(); lblException.Text = "Refund Amount Saved."; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Refund Amount Saved.')", true); con.Close(); con.Dispose(); } catch (Exception ex) { } }