mohammed shamsheer

mohammed shamsheer

  • 1.2k
  • 394
  • 139.7k

tabcycling is not working after datagridinsertin

Dec 24 2014 4:03 AM
question:
tabcycling is not working after datagridinsertin()
the processflow is following:
select guestdetails-->Employee details-->Details to grid-->Advance-->Discount.
tab cycling is moving nicely by default. but if we cycle the tab after gridinsertion it stay on hours textbox(data for datagridinsert)
code :
private void txtnoofPer_KeyUp(object sender, KeyEventArgs e)
{
try
{
if (e.KeyCode == Keys.Enter)
{
ConfCheckinDetailsToGrid();
}
}
catch (Exception ex) { }
}
--------------------------
public void ConfCheckinDetailsToGrid()
{
if (txtTotalHours.Text != "0")
{
string roomID = Convert.ToString(cmbroomno.SelectedValue);
object[,] ParamArray = new object[,] { { "@RoomID", roomID } };
DataSet ds = new DataSet();
ds = DB.ExecuteQuery_SP("SelectRoomDetailsForGridByID", ParamArray);
if (ds.Tables.Count > 0)
{
int row = 0;
row = dgvcheckin1.FirstFreeRow;
//dgvcheckin1.DataSource = null;
dgvcheckin1.Rows.Add();
row = dgvcheckin1.Rows.Count - 1;
dgvcheckin1.Rows[row].Cells["RoomNo"].Value = ds.Tables[0].Rows[0]["RoomNo"].ToString();
dgvcheckin1["RoomNo", row].Value = ds.Tables[0].Rows[0]["RoomNo"].ToString();
dgvcheckin1["RoomCategoryName", row].Value = ds.Tables[0].Rows[0]["RoomCategoryName"].ToString();
dgvcheckin1["RoomCapacity", row].Value = ds.Tables[0].Rows[0]["RoomCapacity"].ToString();
dgvcheckin1["NoofPerson", row].Value = txtTotalHours.Text;
dgvcheckin1["Hours", row].Value = txtTotalHours.Text;
dgvcheckin1["InTime", row].Value = dtpchkintime.Text;
dgvcheckin1["CheckInDate", row].Value = dtpcheckin.Text;
dgvcheckin1["Rents", row].Value = ds.Tables[0].Rows[0]["PerdayRent"].ToString();
dgvcheckin1["TaxAmount", row].Value = ds.Tables[0].Rows[0]["TaxAmount"].ToString();
dgvcheckin1["CheckOutday", row].Value = dtpcheckOutdate.Text;
dgvcheckin1["CheckOutTime", row].Value = dtpouttime.Text;
dgvcheckin1["Roomid", row].Value = cmbroomno.SelectedValue;
if (Convert.ToInt32(txtTotalHours.Text) > 1)
{
double NetTotal = ((Convert.ToDouble(ds.Tables[0].Rows[0]["PerdayRent"]) + Convert.ToDouble(ds.Tables[0].Rows[0]["TaxAmount"])) + ((PolosysHMS.General.Classes.Settings.InventorySettings.ExtraHoursCost) * (Convert.ToDouble(txtTotalHours.Text) - 1)));
dgvcheckin1.Rows[row].Cells["NetTotal"].Value = NetTotal.ToString();
}
//dgvcheckin["RoomId",row].Value = ds.Tables[0].Rows[0]["RoomID"].ToString();
RoomCap = Convert.ToInt32(dgvcheckin1.Rows[row].Cells["RoomCapacity"].Value);
rent = Convert.ToDouble(dgvcheckin1.Rows[row].Cells["Rents"].Value.ToString());
tax = Convert.ToDouble(dgvcheckin1.Rows[row].Cells["TaxAmount"].Value.ToString());
No_Of_Hours = Convert.ToInt32(dgvcheckin1.Rows[row].Cells["Hours"].Value);
//if (txtnoofPer.Text == "")
//{
// txtnoofPer.Text = "0";
//}
No_of_Person = Convert.ToInt32(dgvcheckin1.Rows[row].Cells["NoofPerson"].Value);
//if (No_of_Person > RoomCap)
//{
// Ext_Person = No_of_Person - RoomCap;
// add_amt_forRoom = Ext_Person * 50;
// txttotal.Text = Convert.ToString((rent + tax + add_amt_forRoom) * No_Of_days);
// total += Convert.ToDouble(txttotal.Text);
// txttotal.Text = Convert.ToString(total);
// txtbalance.Text = Convert.ToString(total);
//}
//else
//{
double NetTotalCal = Convert.ToDouble(dgvcheckin1.Rows[row].Cells["NetTotal"].Value);
double totatl = +NetTotalCal;
txttotal.Text = totatl.ToString();
//txttotal.Text = Convert.ToString((rent + tax) * No_Of_Hours);
// total += Convert.ToDouble(txttotal.Text);
// txttotal.Text = Convert.ToString(total);
txtbalance.Text = Convert.ToString(totatl);
txtBillingAmount.Text = Convert.ToString(totatl);
Bal(txtbalance, txttotal, txtadvance, txtDiscount);
}
}
//int Roomno_Bookingprocess = Convert.ToInt32(cmbroomno);
//objGeneralclass.UpdateOnBookingProcess(Convert.ToInt32(cmbroomno.SelectedValue), true);
ClearInputGridField();
}
-------------------------------------------
tested solution :
1. I checked any focus on hourstextbox.
2. test with out updateBookingprocess()function
3. test with out ClearInputGridfield()