public ActionResult CartPage() { try { ViewBag.cartQty = Session["qty"]; ViewBag.prodType = getProdType; ViewBag.getTotalBillAmt = getTotalBillAmt; ViewBag.getQty = getQty; //string tempValid = validDevStr; //string[] tempValidArr = validDevStr.Split(','); //for (int i = 0; i < tempValidArr.Length; i++) //{ // int tempLength = tempValidArr[i].Length; // tempValidArr[i] = tempValidArr[i].Substring(0, tempLength - 2); //} //string tempValidStr = string.Join(",", tempValidArr); string currentSNum = SNumStr.Substring(0, SNumStr.Length - 1); //SNumSession contains updated string of all to be ordered products string[] SNumArr = SNumSession.Split(','); int fmqty = 0, irisqty = 0; for (int i = 0; i < SNumArr.Length - 1; i++) { if (SNumArr[i].ToUpper().StartsWith("B")) { fmqty++; } else { irisqty++; } } ViewBag.fm220qty = fmqty; ViewBag.irisqty = irisqty; if (getProdType.Equals("1")) { cartSrNum++; if (Session["cartEntry"] == null || Session["cartEntry"].Equals("")) { //Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Finger (1 year)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Finger (1 year)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } else { //Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Finger (1 year)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Finger (1 year)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } getProdType = "0"; } else if (getProdType.Equals("2")) { cartSrNum++; if (Session["cartEntry"] == null || Session["cartEntry"].Equals("")) { //Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Finger (Lifetime)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Finger (Lifetime)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } else { //Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Finger (Lifetime)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Finger (Lifetime)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } getProdType = "0"; } else if (getProdType.Equals("3")) { cartSrNum++; if (Session["cartEntry"] == null || Session["cartEntry"].Equals("")) { //Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Extended Support" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Extended Support" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } else { //Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Extended Support" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Extended Support" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } getProdType = "0"; } else if (getProdType.Equals("4")) { cartSrNum++; if (Session["cartEntry"] == null || Session["cartEntry"].Equals("")) { //Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Iris (1 year)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Iris (1 year)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } else { //Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Iris (1 year)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Iris (1 year)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } getProdType = "0"; } else if (getProdType.Equals("5")) { cartSrNum++; if (Session["cartEntry"] == null || Session["cartEntry"].Equals("")) { //Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Iris (Lifetime)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] = HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Iris (Lifetime)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } else { //Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + tempValidStr + "'>RD Service - Iris (Lifetime)" + "</a></td><td>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td><td><a class='delete' href='#'>Remove</a></td></tr>"); Session["cartEntry"] += HttpUtility.HtmlDecode("<tr><td>" + cartSrNum + "</td><td><a href='#' style='text-decoration:none; color:black' data-toggle='tooltip' title='" + currentSNum + "'>RD Service - Iris (Lifetime)" + "</a></td><td id='qtyCell'>" + getQty + "</td><td id='fieldCell'>₹" + getTotalBillAmt + "</td></tr>"); } getProdType = "0"; } else if (getProdType.Equals("-1")) { Session["cartEntry"] = ""; getProdType = "0"; } } catch (Exception ex) { string exMsg = ex.Message.ToString(); } return(View()); }
public void TestDB() { SqlConnection oleDbConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ACPLPayProj1Context"].ConnectionString); oleDbConnection.Open(); //SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM TBLDEVNUM", oleDbConnection); //DataSet dataset = new DataSet(); //dataset.Clear(); //da.Fill(dataset); String temp = ""; string SNumStrDB = SNumSession.Substring(0, SNumSession.Length - 1); for (int i = 0; i < cartSrNum; i++) { SqlCommand getRefNum = new SqlCommand("SELECT (NEXT VALUE FOR REF_NO_SEQ_SUB) AS RF_NO", oleDbConnection); String nxt_seq_val = getRefNum.ExecuteScalar().ToString(); Int64 seq_ref_no = Convert.ToInt64(nxt_seq_val); if (SNumTypeArray[i].Equals("1") && SNumWarrantyArray[i].Equals("N")) //Finger (1 year without warranty) { string[] fqtyArr = SNumStrArray[i].Split(','); string fqty = fqtyArr.Length.ToString(); int paidamt = 118 * Convert.ToInt32(fqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + fqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "1" + "','" + "N" + "','" + payBillname + "','" + "0" + "','" + fqty + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("1") && SNumWarrantyArray[i].Equals("Y")) //Finger (1 year with warranty) { string[] fqtyArr = SNumStrArray[i].Split(','); string fqty = fqtyArr.Length.ToString(); int paidamt = 118 * Convert.ToInt32(fqty) + 177 * Convert.ToInt32(fqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + fqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "1" + "','" + "Y" + "','" + payBillname + "','" + "0" + "','" + fqty + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("2") && SNumWarrantyArray[i].Equals("N")) //Finger (Lifetime without warranty) { string[] fqtyArr = SNumStrArray[i].Split(','); string fqty = fqtyArr.Length.ToString(); int paidamt = 354 * Convert.ToInt32(fqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + fqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "99" + "','" + "N" + "','" + payBillname + "','" + "0" + "','" + fqty + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("2") && SNumWarrantyArray[i].Equals("Y")) //Finger (Lifetime without warranty) { string[] fqtyArr = SNumStrArray[i].Split(','); string fqty = fqtyArr.Length.ToString(); int paidamt = 354 * Convert.ToInt32(fqty) + 177 * Convert.ToInt32(fqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + fqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "99" + "','" + "Y" + "','" + payBillname + "','" + "0" + "','" + fqty + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("3")) //Finger (Extended warranty) { string[] fqtyArr = SNumStrArray[i].Split(','); string fqty = fqtyArr.Length.ToString(); int paidamt = 177 * Convert.ToInt32(fqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + fqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "99" + "','" + "Y" + "','" + payBillname + "','" + "0" + "','" + fqty + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("4")) //Iris (1 year) { string[] iqtyArr = SNumStrArray[i].Split(','); string iqty = iqtyArr.Length.ToString(); int paidamt = 472 * Convert.ToInt32(iqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + iqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "99" + "','" + "N" + "','" + payBillname + "','" + iqty + "','" + "0" + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } if (SNumTypeArray[i].Equals("5")) //Iris (Lifetime) { string[] iqtyArr = SNumStrArray[i].Split(','); string iqty = iqtyArr.Length.ToString(); int paidamt = 1180 * Convert.ToInt32(iqty); SqlCommand command = new SqlCommand ("INSERT INTO TBL_DEV_SUBSCRIPTION_EXT_MST (REF_NO, CUST_NAME, CUST_PHONE, CUST_MAIL, CUST_ADDR1, PIN_CODE, ENTRY_DATE, DEV_QUANTITY, PAYMENT_DETAILS, PAYMENT_FLG, CANCEL_FLG, CUST_ADDR2, CUST_STATE, GSTIN_NO, REMARK, SRNO, PAID_AMT, SUBSCRIPTION_DUR, ADDED_WARRANTY, BILLING_TO, IRIS_QTY, STARTEK_QTY) VALUES('" + seq_ref_no + "','" + payName.Trim().ToUpper() + "','" + payPhNum + "','" + payEmail + "','" + payAddress.Trim().ToUpper() + "','" + payPinCode + "',getdate(),'" + iqty + "','" + "ONLINE - " + payTxnID + "','" + "N" + "','" + "N" + "','" + "" + "','" + payState + "','" + payGSTIN + "','" + "" + "','" + SNumStrArray[i] + "','" + paidamt.ToString() + "','" + "99" + "','" + "N" + "','" + payBillname + "','" + iqty + "','" + "0" + "')", oleDbConnection); string ss = ""; command.ExecuteNonQuery(); //HANDLE ERROR } } }