protected void getLcoBalanceDetails() { Cls_Bussiness_TransHwayUserCreditLimit balObj = new Cls_Bussiness_TransHwayUserCreditLimit(); string username = ""; string category_id = ""; string user_id = ""; string operator_id = ""; if (Session["username"] != null && Session["category"] != null && Session["user_id"] != null && Session["operatorid"] != null) { username = Session["username"].ToString(); category_id = Session["category"].ToString(); user_id = Session["user_id"].ToString(); operator_id = Session["operatorid"].ToString(); } else { Session.Abandon(); Response.Redirect("~/Login.aspx"); } string[] avail_bal = balObj.GetAvailBal(username, category_id, user_id, operator_id); if (avail_bal.Length != 0) { lblUnallocatedBal.Text = avail_bal[0].Trim(); // lbltotalbalance.Text = avail_bal[1].Trim(); lblAllocatedBal.Text = avail_bal[2].Trim(); } else { lblUnallocatedBal.Text = "0"; lblAllocatedBal.Text = "0"; } }
protected void updateBalGrid() { operator_id = ddlLco.SelectedValue.Split('#')[0].ToString(); Cls_Bussiness_TransHwayUserCreditLimit balObj = new Cls_Bussiness_TransHwayUserCreditLimit(); if (category_id == "3" || category_id == "11") { string[] avail_bal = balObj.GetAvailBal(username, category_id, user_id, operator_id); if (avail_bal.Length != 0) { lblAvailBal.Text = avail_bal[0].Trim(); hdnAvailBal.Value = avail_bal[0].Trim(); lbltotalbalance.Text = avail_bal[1].Trim(); lblallocatedbalance.Text = avail_bal[2].Trim(); hdnAvailCreditBal.Value = avail_bal[3].Trim(); lblCreditBal.Text = avail_bal[3].Trim(); } else { //lblAvailBal.Text = "Failed to get available credits"; lblAvailBal.Text = "0"; lblallocatedbalance.Text = "0"; lbltotalbalance.Text = "0"; } balBox.Visible = true; } else { balBox.Visible = false; } grdUsers.DataSource = null; grdUsers.DataBind(); DataTable dtUsers = balObj.GetAllUserDetails(username, category_id, operator_id); if (dtUsers == null || dtUsers.Rows.Count == 0) { lblResponse.Text = "No Users Found"; btnManageCredits.Visible = false; grdUsers.DataSource = null; grdUsers.DataBind(); return; } else { grdUsers.DataSource = dtUsers; grdUsers.DataBind(); btnManageCredits.Visible = true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { //if (txtLCOSearch.Text.Trim() == "" || lblCustNo.Text.Trim() == "") //{ // msgbox("Please Select LCO", txtLCOSearch); // return; //} if (txtNewLimit.Text.Trim() == "") { msgbox("Please Enter Amount", txtNewLimit); return; } else if (txtremark.Text.Trim() == "") { msgbox("Please Enter Remark", txtNewLimit); return; } Hashtable ht = new Hashtable(); //string loggedInUser; //if (Session["username"] != null) //{ // loggedInUser = Session["username"].ToString(); //} //else //{ // Session.Abandon(); // Response.Redirect("~/Login.aspx"); // return; //} ht.Add("UserName", username); ht.Add("LcoId", operid); ht.Add("UserId", lblUserId.Text); ht.Add("Amount", Convert.ToInt32(txtNewLimit.Text.Trim())); ht.Add("Flag", "R"); ht.Add("Remark", txtremark.Text.Trim()); Cls_Bussiness_TransHwayUserCreditLimit obj = new Cls_Bussiness_TransHwayUserCreditLimit(); string response = obj.UserLimitRev(ht); reset(); if (response == "ex_occured") { Response.Redirect("~/ErrorPage.aspx"); return; } lblmsg.Text = response; }
protected void btncnfmBlck_Click(object sender, EventArgs e) { if (Session["username"] != null && Session["operator_id"] != null && Session["category"] != null && Session["user_id"] != null) { username = Convert.ToString(Session["username"]); operator_id = Convert.ToString(Session["operator_id"]); category_id = Convert.ToString(Session["category"]); user_id = Convert.ToString(Session["user_id"]); } else { Response.Redirect("~/Login.aspx"); } Cls_Data_Auth ob = new Cls_Data_Auth(); string ip = ob.GetIPAddress(HttpContext.Current.Request); Hashtable htdata = new Hashtable(); htdata.Add("userid", lblpopuserid.Text.Trim()); htdata.Add("username", lblpopusername.Text.Trim()); htdata.Add("ip", ip); htdata.Add("status", hdnpopstatus.Value); Cls_Bussiness_TransHwayUserCreditLimit objct = new Cls_Bussiness_TransHwayUserCreditLimit(); string result = objct.userblkUnblock(username, htdata); if (result == "9999") { lblResponse.Text = "Updated Successfully"; //blcked successfully ; } else { lblResponse.Text = "failed while updating"; return; } if (category_id == "3") { updateBalGrid(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { Cls_Data_Auth auth = new Cls_Data_Auth(); string Ip = auth.GetIPAddress(HttpContext.Current.Request); if (txtNewLimit.Text.Trim() == "") { msgbox("Please Enter Amount", txtNewLimit); return; } Hashtable ht = new Hashtable(); //string loggedInUser; //if (Session["username"] != null) //{ // loggedInUser = Session["username"].ToString(); //} //else //{ // Session.Abandon(); // Response.Redirect("~/Login.aspx"); // return; //} ht.Add("UserName", username); ht.Add("LcoId", operid); ht.Add("UserId", lblUserId.Text); ht.Add("Amount", Convert.ToInt32(txtNewLimit.Text.Trim())); ht.Add("Flag", "A"); ht.Add("Remark", ""); ht.Add("IP", Ip); Cls_Bussiness_TransHwayUserCreditLimit obj = new Cls_Bussiness_TransHwayUserCreditLimit(); string response = obj.UserLimitRev(ht); reset(); if (response == "ex_occured") { Response.Redirect("~/ErrorPage.aspx"); return; } lblmsg.Text = response; }
protected void btnSearch_Click(object sender, EventArgs e) { lblmsg.Text = ""; txtNewLimit.Text = ""; lblmobno.Text = ""; lblUserId.Text = ""; lblUserName.Text = ""; lblCurLimit.Text = ""; txtremark.Text = ""; Cls_Bussiness_TransHwayUserCreditLimit obj = new Cls_Bussiness_TransHwayUserCreditLimit(); string[] str = obj.GetUserDetails(username, catid, RadSearchby.SelectedValue.ToString(), operid, txtLCOSearch.Text.ToString()); try { if (str.Length != 0) { lblUserId.Text = str[0].Trim(); lblUserName.Text = str[1].Trim(); lblmobno.Text = str[2].Trim(); lblCurLimit.Text = str[3].Trim(); divdet.Visible = true; } else { divdet.Visible = false; msgbox("No Such User Found", txtLCOSearch); return; } } catch (Exception ex) { msgbox("Please Select User by code or name", txtLCOSearch); return; } finally { } }
protected void btnManageCredits_Click(object sender, EventArgs e) { if (category_id == "11") { operator_id = ddlLco.SelectedValue.Split('#')[0].ToString(); } double inc_cr = 0; double dec_cr = 0; double total_cr = 0; double avail_bal = 0; string strCreditInfo = ""; Cls_Data_Auth auth = new Cls_Data_Auth(); string Ip = auth.GetIPAddress(HttpContext.Current.Request); foreach (GridViewRow row in grdUsers.Rows) { TextBox txtInc = (TextBox)row.FindControl("txtIncLimit"); TextBox txtDec = (TextBox)row.FindControl("txtDecLimit"); double avail_usr_bal = Convert.ToDouble(row.Cells[2].Text.Trim()); HiddenField hdnUserId = (HiddenField)row.FindControl("hdnUserId"); if (txtInc.Text.Trim() != "0" || txtDec.Text.Trim() != "0") { if (txtDec.Text.Trim() != "0") { //check decrease value < avail bal if (avail_usr_bal < Convert.ToDouble(txtDec.Text.Trim())) { lblResponse.Text = "Decrease value must be less than allocated balance"; txtDec.Focus(); return; } } strCreditInfo += hdnUserId.Value + "$" + txtInc.Text + "$" + txtDec.Text + "~"; if (txtInc.Text.Trim() != "0") { inc_cr = inc_cr + Convert.ToDouble(txtInc.Text.Trim()); } if (txtDec.Text.Trim() != "0") { dec_cr = dec_cr + Convert.ToDouble(txtDec.Text.Trim()); } } } strCreditInfo = strCreditInfo.TrimEnd('~'); total_cr = inc_cr - dec_cr; avail_bal = Convert.ToDouble(hdnAvailBal.Value);// -Convert.ToDouble(hdnAvailCreditBal.Value);// hdnAvailCreditBal is New Credit Balance if (avail_bal < total_cr) { lblResponse.Text = "You dont have enough balance for distribution"; return; } else { if (strCreditInfo == "") { lblResponse.Text = "Set balance for atleast one user"; return; } Cls_Bussiness_TransHwayUserCreditLimit crd = new Cls_Bussiness_TransHwayUserCreditLimit(); string creditRes = crd.setCredits(username, strCreditInfo, operator_id, Ip); if (creditRes.Split('$')[0] != "9999") { lblResponse.Text = "Setting balance failed : " + creditRes.Split('$')[1]; return; } else { lblResponse.Text = creditRes.Split('$')[1]; updateBalGrid(); return; } } }