protected void TxtAccno_TextChanged(object sender, EventArgs e) { try { if (ViewState["Flag"].ToString() == "SB") { accno = TxtAccno.Text; string AT = ""; AT = BD.Getstage1(TxtAccno.Text, Session["BRCD"].ToString(), TxtProdCde.Text); if (AT != null) { if (AT != "1003") { WebMsgBox.Show("Sorry Customer not Authorise.........!!", this.Page); TxtAccno.Text = ""; TxtAccname.Text = ""; TxtAccno.Focus(); } else { DataTable DT = new DataTable(); DT = LF.GetCustName(TxtProdCde.Text, TxtAccno.Text, Session["BRCD"].ToString()); if (DT.Rows.Count > 0) { string[] CustName = DT.Rows[0]["CustName"].ToString().Split('_'); TxtAccname.Text = CustName[0].ToString(); TxtCustno.Text = CustName[1].ToString(); TxtAccSts.Text = DT.Rows[0]["ACC_STATUS"].ToString(); } } } else { WebMsgBox.Show("Enter valid account number...!!", this.Page); TxtAccno.Text = ""; TxtAccno.Focus(); } } if (ViewState["Flag"].ToString() == "AT") { string status = ""; sql = "SELECT ACC_STATUS FROM AVS_ACC WHERE BRCD='" + TxtBRCD.Text + "' AND ACCNO='" + TxtAccno.Text + "' AND CUSTNO='" + TxtCustno.Text + "' AND SUBGLCODE='" + TxtProdCde.Text + "' AND STAGE<>1004"; status = conn.sExecuteScalar(sql); if (status == "9") { WebMsgBox.Show("Already Authorized!!", this.Page); } else { DataTable DT = new DataTable(); DT = LF.GetCustName(TxtProdCde.Text, TxtAccno.Text, TxtBRCD.Text); if (DT.Rows.Count > 0) { string[] CustName = DT.Rows[0]["CustName"].ToString().Split('_'); TxtAccname.Text = CustName[0].ToString(); TxtCustno.Text = CustName[1].ToString(); TxtAccSts.Text = DT.Rows[0]["ACC_STATUS"].ToString(); } DataTable dt = new DataTable(); dt = LF.GetInfo(TxtAccno.Text, TxtProdCde.Text, TxtBRCD.Text); if (dt.Rows.Count > 0) { TxtCaseOfDate.Text = dt.Rows[0]["CASE_OF_DATE"].ToString(); TxtReason.Text = dt.Rows[0]["REASON"].ToString(); } else { WebMsgBox.Show("Invalid Account number for Loan case File!!", this.Page); clear(); } } } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
protected void BTNOCASEPT_Click(object sender, EventArgs e) { if (rdbAll.Checked == true) { FL = "All"; if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter from Date.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter To Date.", this.Page); } if (rbtSep.Checked == false && rdbAll.Checked == false) { WebMsgBox.Show("Please Select Item.", this.Page); } } if (rbtSep.Checked == true) { FL = "Specific"; if (txtTsro.Text == "") { WebMsgBox.Show("Please enter From SRNO.", this.Page); } if (txtFsro.Text == "") { WebMsgBox.Show("Please enter To SRNO.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter from Date.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter To Date.", this.Page); } } DataTable dt = new DataTable(); dt = SRO.RPTNOOFCASERPT(FL, txtFromDate.Text, txtToDate.Text, txtFsro.Text, txtTsro.Text); //dt = SRO.RptSRNOMONTHLYRPTS(flag:FL,FDATE:txtFromDate.Text,TDATE:txtToDate.Text,FSRNO:txtFsro.Text,TSRNO:txtTsro.Text); GridView gv2 = new GridView(); gv2.DataSource = dt; gv2.DataBind(); Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=No_OF_CASE.xls"); Response.ContentType = "application/vnd.ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); gv2.RenderControl(hw); Response.Output.Write(sw.ToString()); Response.End(); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { if (CnfResult.Value == "true") { if (drpSubgroup.SelectedValue == "0" || ddlAccountGroup.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Please Select Account Group and Sub Group.');", true); return; } sqlobj.ExecuteSQLNonQuery("SP_AccountMaster", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@AccountCode", SqlDbType = SqlDbType.NVarChar, Value = txtAccountCode.Text }, new SqlParameter() { ParameterName = "@AccountName", SqlDbType = SqlDbType.NVarChar, Value = txtAccountName.Text }, new SqlParameter() { ParameterName = "@AccountGroup", SqlDbType = SqlDbType.NVarChar, Value = ddlAccountGroup.SelectedValue }, new SqlParameter() { ParameterName = "@AccountType", SqlDbType = SqlDbType.NVarChar, Value = "G" }, new SqlParameter() { ParameterName = "@Remarks", SqlDbType = SqlDbType.NVarChar, Value = txtRemarks.Text }, new SqlParameter() { ParameterName = "@SubGrp", SqlDbType = SqlDbType.NVarChar, Value = drpSubgroup.SelectedValue }, new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = Session["UserID"].ToString() }, new SqlParameter() { ParameterName = "@AccountsMRSN", SqlDbType = SqlDbType.NVarChar, Value = Session["RSN"].ToString() } ); Clear(); LnkSH.Text = "Add Account Code"; LoadAccountMaster(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Account Master details updated');", true); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
private void PSVR2(string pscode) { try { DataSet dscheck = sqlobj.ExecuteSP("SP_CheckNotUpdatedAssetItems", new SqlParameter() { ParameterName = "@PSCode", SqlDbType = SqlDbType.NVarChar, Value = pscode.ToString() }); int icount = 0; if (dscheck.Tables[0].Rows.Count > 0) { icount = Convert.ToInt32(dscheck.Tables[0].Rows[0]["Count"].ToString()); } dscheck.Dispose(); if (icount == 0) { DataSet dsExporttoexcel = sqlobj.ExecuteSP("SP_GetExcelforAssetPhysicalStock", new SqlParameter() { ParameterName = "@PSCode", SqlDbType = SqlDbType.NVarChar, Value = pscode.ToString() }, new SqlParameter() { ParameterName = "@Mode", SqlDbType = SqlDbType.Int, Value = 2 }); if (dsExporttoexcel.Tables[0].Rows.Count > 0) { DataTable dt = dsExporttoexcel.Tables[0]; string filename = "PSVR2- Report after asset verification _ " + DateTime.Today.ToString("dd-MM-yyyy") + ".xls"; System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); hw.Write("<table style='width:100%'><tr><td colspan='10'>PSVR2- Report after asset verification</td></tr>"); hw.Write("<tr><td colspan='10'>For posting stock adjustment transactions</td></tr>"); hw.Write("<tr><td colspan='10'>BatchCode:" + pscode.ToString() + " Date:" + Session["BatchDate"].ToString() + "                   Printed On:" + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "</td></tr></table>"); DataGrid dgGrid = new DataGrid(); dgGrid.DataSource = dt; dgGrid.DataBind(); dgGrid.RenderControl(hw); Response.ContentType = "application/vnd.ms-excel"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + ""); Response.Write(tw.ToString()); Response.End(); } dsExporttoexcel.Dispose(); } else { WebMsgBox.Show("Please check! Have you update all items in this batch."); } } catch (Exception ex) { } }
protected void BtnVenderMasterAdd_Click(object sender, EventArgs e) { if (ViewState["Flag"].ToString() == "AD") { if (txtVendorID.Text == "") { WebMsgBox.Show("Enter Vendor ID ..!!", this.Page); return; } if (txtVendorName.Text == "") { WebMsgBox.Show("Enter Vendor Name..!!", this.Page); return; } if (txtProductID.Text == "") { WebMsgBox.Show("Enter Product ID..!!", this.Page); return; } if (txtProductName.Text == "") { WebMsgBox.Show("Enter Product Name..!!", this.Page); return; } if (txtQuantity.Text == "") { WebMsgBox.Show("Enter Quantity..!!", this.Page); return; } try { sResult = CS.OpeningStock(FLAG: "AD", BRCD: txtBRCD.Text, VENDORID: txtVendorID.Text, PRODID: txtProductID.Text, UNITCOST: txtRate.Text, QTY: txtQuantity.Text, AMOUNT: txtTotalAmount.Text, SGST: txtSGSTPercent.Text, CGST: txtCGSTPercent.Text, SGSTAMT: txtSGSTAmount.Text, CGSTAMT: txtCGSTAmount.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString());// if (sResult.StartsWith("AD#")) { string[] Array = sResult.Split('#'); string title = sResult.Replace("\n", " ");; string body = "Welcome to ASPSnippets.com"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Popup", "ShowPopup('Stock Create Succefully!');", true); clear(); } else if (sResult == "ALREADYEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Stock Already Present!')", true); } else if (sResult.StartsWith("NOTEXISTS")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Stock Not Available Under Vender Master!')", true); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } if (ViewState["Flag"].ToString() == "ATH") { try { sResult = CS.OpeningStock(FLAG: "ATH", BRCD: txtBRCD.Text, VENDORID: txtVendorID.Text, PRODID: txtProductID.Text, QTY: txtQuantity.Text, UNITCOST: txtRate.Text, SGST: txtSGSTPercent.Text, CGST: txtCGSTPercent.Text, SGSTAMT: txtSGSTAmount.Text, CGSTAMT: txtCGSTAmount.Text, AMOUNT: txtTotalAmount.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString());// if (sResult.StartsWith("ATH#")) { string[] Array = sResult.Split('#'); string title = sResult.Replace("\n", " ");; string body = "Welcome to ASPSnippets.com"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Popup", "ShowPopup('Authorize Succefully!');", true); clear(); } else if (sResult == "NOTEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Not Present!')", true); } else if (sResult.StartsWith("NOTAUTH")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Are Not Authorize Person')", true); } else if (sResult.StartsWith("ALREADYAUTH")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Already Authorize ')", true); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } if (ViewState["Flag"].ToString() == "MD") { try { sResult = CS.OpeningStock(FLAG: "MD", BRCD: txtBRCD.Text, VENDORID: txtVendorID.Text, PRODID: txtProductID.Text, QTY: txtQuantity.Text, UNITCOST: txtRate.Text, SGST: txtSGSTPercent.Text, CGST: txtCGSTPercent.Text, SGSTAMT: txtSGSTAmount.Text, CGSTAMT: txtCGSTAmount.Text, AMOUNT: txtTotalAmount.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString());// if (sResult.StartsWith("MD#")) { string[] Array = sResult.Split('#'); string title = sResult.Replace("\n", " ");; string body = "Welcome to ASPSnippets.com"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Popup", "ShowPopup('Modify Succefully!');", true); clear(); } else if (sResult == "ALREADYAUTH") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Already Authoize Stock!')", true); } else if (sResult.StartsWith("NOTEXISTS")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Stock Not Presnt Try Again!')", true); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } if (ViewState["Flag"].ToString() == "DEL") { try { sResult = CS.OpeningStock(FLAG: "DEL", BRCD: txtBRCD.Text, VENDORID: txtVendorID.Text, PRODID: txtProductID.Text, QTY: txtQuantity.Text, UNITCOST: txtRate.Text, SGST: txtSGSTPercent.Text, CGST: txtCGSTPercent.Text, SGSTAMT: txtSGSTAmount.Text, CGSTAMT: txtCGSTAmount.Text, AMOUNT: txtTotalAmount.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString());// if (sResult.StartsWith("DEL#")) { string[] Array = sResult.Split('#'); string title = sResult.Replace("\n", " ");; string body = "Welcome to ASPSnippets.com"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Popup", "ShowPopup('Delete Succefully!');", true); } else if (sResult == "ALREADYAUTH") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Already Authorize!')", true); } else if (sResult.StartsWith("NOTEXISTS")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Stock not Present')", true); } clear(); } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } }
protected void Btn_Report_Click(object sender, EventArgs e) { DT = new DataTable(); try { int tmp = 0; string SetNo = "", RefId = ""; if (txtBrCode.Text.ToString() == "") { txtBrCode.Focus(); WebMsgBox.Show("Enter branch code first", this.Page); return; } else if (txtProdCode.Text.ToString() == "") { txtProdCode.Focus(); WebMsgBox.Show("Enter procudt code first", this.Page); return; } else if (txtAsOnDate.Text.ToString() == "") { txtAsOnDate.Focus(); WebMsgBox.Show("Enter as on date first", this.Page); return; } else if (txtProdCode2.Text.ToString() == "") { txtProdCode2.Focus(); WebMsgBox.Show("Enter product code first ...!!", this.Page); return; } else { System.Text.StringBuilder Sb = new System.Text.StringBuilder(); Label Str_Id; foreach (GridViewRow gvRow in grdDevident.Rows) { if (((CheckBox)gvRow.FindControl("chk")).Checked) { Str_Id = (Label)gvRow.FindControl("lblSrNum"); if (Sb.Length == 0) { Sb.Append(Str_Id.Text.ToString()); } else { Sb.Append("," + Str_Id.Text.ToString()); } } } string redirectURL = "FrmRView.aspx?FLAG=0&ID=" + Sb.ToString() + "&rptname=RptDivPayTrans.rdlc" + ""; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + redirectURL + "','_blank')", true); } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
protected void btnStockUpdate_Click(object sender, EventArgs e) { try { int count = 0; foreach (GridDataItem item in rgUpdateStock.MasterTableView.Items) { TextBox txtphysicalstock = (TextBox)item.FindControl("txtphysicalstock"); if (txtphysicalstock.Text == "-1") { count = count + 1; } } if (count == 0) { foreach (GridDataItem item in rgUpdateStock.MasterTableView.Items) { string stritemcode = item["AssetCode"].Text.ToString(); string strrsn = item["RSN"].Text.ToString(); TextBox txtphysicalstock = (TextBox)item.FindControl("txtphysicalstock"); decimal strphysicalstock = Convert.ToDecimal(txtphysicalstock.Text); if (strphysicalstock >= 0) { sqlobj.ExecuteSQLNonQuery("SP_UpdateAssetStock", new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = strrsn.ToString() }, new SqlParameter() { ParameterName = "@AssetCode", SqlDbType = SqlDbType.NVarChar, Value = stritemcode.ToString() }, new SqlParameter() { ParameterName = "@PhysicalStock", SqlDbType = SqlDbType.Decimal, Value = strphysicalstock.ToString() } ); } } LoadPhysicalStock(); rgUpdateStock.DataSource = string.Empty; rgUpdateStock.DataBind(); dvUpdatePhysicalStock.Visible = true; dvUpdateStock.Visible = false; WebMsgBox.Show("Asset verification details updated successfully"); } else { WebMsgBox.Show("Please check! Are you update all items in this batch."); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
public static void checkbalance() { // btnHidden_Click(null, null); WebMsgBox.Show("success"); }
protected void btnSignIn_Click(object sender, EventArgs e) { try { SQLProcs sqlobj = new SQLProcs(); DataSet dsChkAct = new DataSet(); DataSet dsChkPwd = new DataSet(); DataSet dsChkSt = new DataSet(); DataSet dsChkPwdDt = new DataSet(); Session["UserID"] = string.Empty; Session["SUPASSWORD"] = txtPlainPassword.Text; DataSet dsCompanyDetails = new DataSet(); if (txtUserID.Text == "admin" && txtPlainPassword.Text == "a#m$n~") { Session["UserID"] = txtUserID.Text; Session["SUPASSWORD"] = txtPlainPassword.Text; Response.Redirect("Admin.aspx"); //FormsAuthentication.RedirectFromLoginPage(txtUserID.Text, false); } else { // -- Start check balance DateTime LastDebitDate; DateTime CurrentDate; DataSet dsCheckFirstLogin = sqlobj.SQLExecuteDataset("SP_GetDebitDate"); if (dsCheckFirstLogin.Tables[0].Rows.Count > 0) { string sdate = dsCheckFirstLogin.Tables[0].Rows[0]["LastDebitDate"].ToString(); string ldd = ""; string cdd = ""; if (dsCheckFirstLogin.Tables[1].Rows.Count > 0) { LastDebitDate = Convert.ToDateTime(dsCheckFirstLogin.Tables[0].Rows[0]["LastDebitDate"].ToString()); CurrentDate = DateTime.Now; ldd = LastDebitDate.ToString("dd-MM-yyyy"); cdd = CurrentDate.ToString("dd-MM-yyyy"); } else { LastDebitDate = DateTime.Now.AddDays(-1); CurrentDate = DateTime.Now; ldd = LastDebitDate.ToString("dd-MM-yyyy"); cdd = CurrentDate.ToString("dd-MM-yyyy"); } if (ldd.Equals(cdd)) { dsCompanyDetails = sqlobj.SQLExecuteDataset("SP_GetCompanyDetails"); if (dsCompanyDetails.Tables[0].Rows.Count != 0) { string strproductname = dsCompanyDetails.Tables[0].Rows[0]["productname"].ToString(); if (strproductname != "") { dsChkAct = sqlobj.SQLExecuteDataset("proc_LoginCheck", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = Session["SUPASSWORD"].ToString() }); if (dsChkAct != null && dsChkAct.Tables.Count > 0 && dsChkAct.Tables[0].Rows.Count > 0) { ////Check Status //dsChkSt = sqlobj.SQLExecuteDataset("SP_CheckStatus", // new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, // new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); if (dsChkAct.Tables[0].Rows.Count != 0) { dsChkPwd = sqlobj.SQLExecuteDataset("SP_CheckUIPwd", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = Session["SUPASSWORD"].ToString() }); if (dsChkPwd.Tables[0].Rows.Count == 0) { //Session["UserID"] = txtUserID.Text.Trim(); Session["UserID"] = dsChkAct.Tables[0].Rows[0]["UserID"].ToString(); Session["Action"] = "LogIn"; InsertLoginAudit(); InsertUsageLog(); FormsAuthentication.RedirectFromLoginPage(txtUserID.Text, false); //Response.Redirect("ManageNTaskList.aspx?UserName="******"UserID"].ToString()); //Response.Redirect("Home.aspx"); return; } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Function", "NavigateDir2();", true); return; } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: User is Terminated/Blocked"); //msgbox.ShowError("Access Denied: User is Terminated/Blocked"); } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: Invalid User ID / Password"); return; } } else { WebMsgBox.Show("OOPS! Something is broken! Contact the dealer from whom you bought the software license."); } } } else { //RadWindowManager1.RadConfirm("<b>FIRST SIGN-IN FOR THE DAY</b>.<br/><b>USAGE FEES WILL BE DEDUCTED NOW.</b><br/><b>CONFIRM?</b>", "confirmStatusCallbackFn", 400, 200, null, "Confirm"); ScriptManager.RegisterStartupScript(this, this.GetType(), "CallConfirmBox", "CallConfirmBox();", true); // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyFun1", "confirmStatusCallbackFn();", true); // RadWindowManager1.onclien //RadWindow2.VisibleOnPageLoad = true; // RadWindow2.Visible = true; } //else //{ // //RadWindowManager1.RadConfirm("<b>FIRST SIGN-IN FOR THE DAY</b>.<br/><b>USAGE FEES WILL BE DEDUCTED NOW.</b><br/><b>CONFIRM?</b>", "confirmStatusCallbackFn", 400, 200, null, "Confirm"); // // ScriptManager.RegisterStartupScript(this, this.GetType(), "CallConfirmBox", "CallConfirmBox();", true); // // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyFun1", "confirmStatusCallbackFn();", true); // Response.Redirect("PayDetails.aspx", false); //} } } // End check Balance } catch (Exception ex) { WebMsgBox.Show(ex.Message.ToString()); } }
protected void LoadData() { try { if ((Session["UserLevel"].ToString() == "1Manager") || (Session["UserLevel"].ToString() == "2CoOrdinator")) { //DataSet ds1 = new DataSet(); //ds1 = proc.SQLExecuteDataset("SP_LookUpDet", // new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 1 }, // new SqlParameter() { ParameterName = "@CodeId", SqlDbType = SqlDbType.Char, Value = "TT" } // ); //DdlTxnType.DataSource = ds1.Tables[0]; //DdlTxnType.DataTextField = "ShortDesc"; //DdlTxnType.DataValueField = "CodeValue"; //DdlTxnType.DataBind(); //DdlTxnType.Items.Insert(0, "Please Select"); //DdlTxnType.SelectedValue = "00"; BtnApply.Text = "Update"; //BtnAdd.Visible = true; } else { BtnApply.Text = "Save"; // BtnAdd.Visible = false; } DataSet ds = new DataSet(); ds = proc.SQLExecuteDataset("SP_LeaveDet", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 6 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = Convert.ToInt16(Request.QueryString["RSN"]) } ); if (ds.Tables[0].Rows.Count > 0) { DdlStaffid.SelectedValue = ds.Tables[0].Rows[0]["StaffId"].ToString(); DdlLeaveType.SelectedValue = ds.Tables[0].Rows[0]["LT"].ToString(); TxtLeaveStart.Text = ds.Tables[0].Rows[0]["LeaveStart"].ToString(); TxtReturnDate.Text = ds.Tables[0].Rows[0]["ReturnDate"].ToString(); //TxtLeaveEndDate.Text = ds.Tables[0].Rows[0]["LeaveEndDate"].ToString(); //TxtTotDays.Text = ds.Tables[0].Rows[0]["TotalDays"].ToString(); TxtLeaveDays.Text = ds.Tables[0].Rows[0]["LeaveDays"].ToString(); TxtReason.Text = ds.Tables[0].Rows[0]["Reason"].ToString(); //DdlStatus.SelectedValue = ds.Tables[0].Rows[0]["Status1"].ToString(); DdlReportTo.SelectedValue = ds.Tables[0].Rows[0]["ReportTo"].ToString(); LoadLeave(DdlStaffid.SelectedValue); Status = ds.Tables[0].Rows[0]["Status1"].ToString(); AppDate = ds.Tables[0].Rows[0]["ApprovedDate"].ToString(); AppBy = ds.Tables[0].Rows[0]["ApprovedBy"].ToString(); } } catch (Exception ex) { WebMsgBox.Show("Failed on load leave details!"); } }
protected void btnExportTat_Click(object sender, EventArgs e) { try { SqlProcsNew proc = new SqlProcsNew(); //DataSet dsGrid2 = new DataSet(); DataSet dsTAT = proc.ExecuteSP("SP_SecFetchTATDetails", new SqlParameter() { ParameterName = "@iMode", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int, Value = 1 }, new SqlParameter() { ParameterName = "@UserID", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.NVarChar, Value = Session["UserId"].ToString() }, new SqlParameter() { ParameterName = "@Fromdate", SqlDbType = SqlDbType.DateTime, Value = dtpFromDate.SelectedDate.ToString() }, new SqlParameter() { ParameterName = "@Todate", SqlDbType = SqlDbType.DateTime, Value = dtpTillDate.SelectedDate.ToString() }); if (dsTAT.Tables[0].Rows.Count > 0) { DataGrid dg = new DataGrid(); dg.DataSource = dsTAT.Tables[0]; dg.DataBind(); DateTime sdate = dtpFromDate.SelectedDate.Value; DateTime edate = dtpTillDate.SelectedDate.Value; // THE EXCEL FILE. string sFileName = "TAT_SummaryRpt_" + sdate.ToString("dd/MM/yyyy") + " To " + edate.ToString("dd/MM/yyyy") + ".xls"; sFileName = sFileName.Replace("/", ""); // SEND OUTPUT TO THE CLIENT MACHINE USING "RESPONSE OBJECT". Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=" + sFileName); Response.ContentType = "application/vnd.ms-excel"; EnableViewState = false; System.IO.StringWriter objSW = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter objHTW = new System.Web.UI.HtmlTextWriter(objSW); dg.HeaderStyle.Font.Bold = true; // SET EXCEL HEADERS AS BOLD. dg.RenderControl(objHTW); Response.Write("<table><tr><td><b>Turnaround Time(TAT) Report</td><td> From:" + sdate.ToString("dd/MM/yyyy") + "</td><td> To:" + edate.ToString("dd/MM/yyyy") + "</td><td>" + " " + "</td></b></tr></table>"); // STYLE THE SHEET AND WRITE DATA TO IT. Response.Write("<style> TABLE { border:dotted 1px #999; } " + "TD { border:dotted 1px #D5D5D5; text-align:center } </style>"); Response.Write(objSW.ToString()); Response.End(); dg = null; } else { //WebMsgBox.Show(" From" + dtpFromDate.SelectedDate.Value + " To " + dtpTillDate.SelectedDate.Value + " Preview Summary does not exist"); WebMsgBox.Show("There are no records to Export"); } } catch (Exception ex) { //WebMsgBox.Show(ex.Message); } }
protected void TxtReturnDate_TextChanged(object sender, EventArgs e) { try { DataSet ds = new DataSet(); String msg = null; int flag = 0; if ((TxtLeaveStart.Text != "") && (TxtReturnDate.Text != "")) { DateTime retdate = Convert.ToDateTime(TxtReturnDate.Text); do { ds = proc.SQLExecuteDataset("SP_HolidayDet", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 4 }, new SqlParameter() { ParameterName = "@HolidayDate", SqlDbType = SqlDbType.Date, Value = retdate } ); if ((ds.Tables[0].Rows.Count == 0) && (retdate.DayOfWeek.ToString() != "Sunday")) { TxtReturnDate.Text = retdate.ToString("dd-MMM-yyyy"); flag = 0; } else { retdate = retdate.AddDays(1); flag = 1; //retdate = Convert.ToDateTime(ds.Tables[0].Rows[0]["HolidayDate"]).AddDays(1); msg = "you select return date is holiday. The system change return when office next working day!"; } }while (flag == 1); DataSet ds1 = new DataSet(); ds1 = proc.SQLExecuteDataset("SP_HolidayDet", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 5 }, new SqlParameter() { ParameterName = "@StartDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtLeaveStart.Text) }, new SqlParameter() { ParameterName = "@EndDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtReturnDate.Text) } ); int leave = Convert.ToInt16(ds1.Tables[0].Rows[0]["Leave"]); for (DateTime i = Convert.ToDateTime(TxtLeaveStart.Text); i < Convert.ToDateTime(TxtReturnDate.Text); i = i.AddDays(1)) { if (i.DayOfWeek.ToString() == "Sunday") { leave = leave + 1; } } DateTime dstart = Convert.ToDateTime(TxtLeaveStart.Text); DateTime dreturn = Convert.ToDateTime(TxtReturnDate.Text); if (dreturn >= dstart) { if (Convert.ToDouble((dreturn - dstart).Days) == 0.0) { TxtLeaveDays.Text = "0.5"; } else { TxtLeaveDays.Text = (Convert.ToDouble((dreturn - dstart).Days) - (leave)).ToString(); } } else { WebMsgBox.Show("The return date must be greaterthan or equal to start date!"); } } if (msg != null) { WebMsgBox.Show(msg); } } catch (Exception ex) { WebMsgBox.Show("Error on check return date!"); } }
protected void CheckLeave(int rsn) { double cl = 0, el = 0, sl = 0; try { DataSet ds1 = new DataSet(); int staffid = Convert.ToInt16(DdlStaffid.SelectedValue); ds1 = proc.SQLExecuteDataset("SP_LeaveTxns", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 7 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = rsn } ); DataSet ds = new DataSet(); ds = proc.SQLExecuteDataset("SP_LeaveAllow", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 1 }, new SqlParameter() { ParameterName = "@StaffId", SqlDbType = SqlDbType.Int, Value = staffid } ); if (ds.Tables[0].Rows.Count > 0) { cl = Convert.ToDouble(ds.Tables[0].Rows[0]["Casual"]); el = Convert.ToDouble(ds.Tables[0].Rows[0]["Earn"]); sl = Convert.ToDouble(ds.Tables[0].Rows[0]["Sick"]); } for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { if (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Casual Debit") { cl = cl + Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } else if (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Casual Credit") { cl = cl - Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } else if (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Sick Debit") { sl = sl + Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } else if (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Sick Credit") { sl = sl - Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } else if ((ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Earn Debit") || (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Other Debit") || (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Unauthorized Debit")) { el = el + Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } else if ((ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Earn Credit") || (ds1.Tables[0].Rows[i]["TxnType"].ToString() == "Other Credit")) { el = el - Convert.ToDouble(ds1.Tables[0].Rows[i]["LeaveDays"]); } } proc.ExecuteSQLNonQuery("SP_LeaveAllow", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@StaffId", SqlDbType = SqlDbType.Int, Value = staffid }, new SqlParameter() { ParameterName = "@Casual", SqlDbType = SqlDbType.Float, Value = cl }, new SqlParameter() { ParameterName = "@Earn", SqlDbType = SqlDbType.Float, Value = el }, new SqlParameter() { ParameterName = "@Sick", SqlDbType = SqlDbType.Float, Value = sl }, new SqlParameter() { ParameterName = "@M_ID", SqlDbType = SqlDbType.Int, Value = staffid } ); proc.ExecuteSQLNonQuery("SP_LeaveTxns", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 3 }, new SqlParameter() { ParameterName = "@LeaveId", SqlDbType = SqlDbType.Int, Value = rsn } ); } catch (Exception ex) { WebMsgBox.Show("Error on check leave!"); } }
protected void BtnApply_Click(object sender, EventArgs e) { try { if (BtnApply.Text == "Save") { proc.ExecuteSQLNonQuery("SP_LeaveDet", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = Convert.ToInt32(Request.QueryString["RSN"]) }, new SqlParameter() { ParameterName = "@Staffid", SqlDbType = SqlDbType.BigInt, Value = Convert.ToInt64(DdlStaffid.SelectedValue) }, new SqlParameter() { ParameterName = "@LeaveType", SqlDbType = SqlDbType.Char, Value = DdlLeaveType.SelectedValue }, new SqlParameter() { ParameterName = "@LeaveStart", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtLeaveStart.Text) }, new SqlParameter() { ParameterName = "@ReturnDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtReturnDate.Text) }, //new SqlParameter() { ParameterName = "@LeaveDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtLeaveEndDate.Text) }, new SqlParameter() { ParameterName = "@LeaveDays", SqlDbType = SqlDbType.Float, Value = Convert.ToDouble(TxtLeaveDays.Text) }, // new SqlParameter() { ParameterName = "@TotalDays", SqlDbType = SqlDbType.Float, Value = Convert.ToDouble(TxtTotDays.Text) }, new SqlParameter() { ParameterName = "@Reason", SqlDbType = SqlDbType.VarChar, Value = TxtReason.Text }, new SqlParameter() { ParameterName = "@Status", SqlDbType = SqlDbType.Char, Value = DdlStatus.SelectedValue }, new SqlParameter() { ParameterName = "@ReportTo", SqlDbType = SqlDbType.NVarChar, Value = DdlReportTo.SelectedValue }, new SqlParameter() { ParameterName = "@M_ID", SqlDbType = SqlDbType.VarChar, Value = Session["Staffid"].ToString() } ); } else { if (Status != DdlStatus.SelectedValue) { AppBy = Session["StaffId"].ToString(); AppDate = DateTime.Now.ToString(); } proc.ExecuteSQLNonQuery("SP_LeaveDet", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = Convert.ToInt32(Request.QueryString["RSN"]) }, new SqlParameter() { ParameterName = "@Staffid", SqlDbType = SqlDbType.BigInt, Value = Convert.ToInt64(DdlStaffid.SelectedValue) }, new SqlParameter() { ParameterName = "@LeaveType", SqlDbType = SqlDbType.Char, Value = DdlLeaveType.SelectedValue }, new SqlParameter() { ParameterName = "@LeaveStart", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtLeaveStart.Text) }, new SqlParameter() { ParameterName = "@ReturnDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtReturnDate.Text) }, //new SqlParameter() { ParameterName = "@LeaveDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(TxtLeaveEndDate.Text) }, new SqlParameter() { ParameterName = "@LeaveDays", SqlDbType = SqlDbType.Float, Value = Convert.ToDouble(TxtLeaveDays.Text) }, // new SqlParameter() { ParameterName = "@TotalDays", SqlDbType = SqlDbType.Float, Value = Convert.ToDouble(TxtTotDays.Text) }, new SqlParameter() { ParameterName = "@Reason", SqlDbType = SqlDbType.VarChar, Value = TxtReason.Text }, new SqlParameter() { ParameterName = "@Status", SqlDbType = SqlDbType.Char, Value = DdlStatus.SelectedValue }, new SqlParameter() { ParameterName = "@ReportTo", SqlDbType = SqlDbType.NVarChar, Value = DdlReportTo.SelectedValue }, new SqlParameter() { ParameterName = "@ApprovedBy", SqlDbType = SqlDbType.Int, Value = Convert.ToInt64(AppBy) }, new SqlParameter() { ParameterName = "@ApprovedDate", SqlDbType = SqlDbType.Date, Value = Convert.ToDateTime(AppDate) }, new SqlParameter() { ParameterName = "@M_ID", SqlDbType = SqlDbType.VarChar, Value = Session["Staffid"] } ); if ((Status != DdlStatus.SelectedValue) && (DdlStatus.SelectedValue != "AP")) { CheckLeave(Convert.ToInt32(Request.QueryString["RSN"])); } } Clear(); ClientScript.RegisterStartupScript(typeof(Page), "close", "<script type='text/javascript'>alert('Leave has been saved successfully!'); window.opener.location.reload(); window.close();</script>"); } catch (Exception ex) { WebMsgBox.Show("Failed on apply leave!"); } }
protected void btnRegister_Click(object sender, EventArgs e) { string passEncode = StringClass.Encrypt(txtPassword.Text); #region [TestInput] if (txtUsername.Text.Trim().Equals("")) { WebMsgBox.Show("Username not null !"); txtUsername.Focus(); return; } if (txtPassword.Text.Trim().Equals("")) { WebMsgBox.Show("Password not null !"); txtUsername.Focus(); return; } if (txtReenterPassword.Text.Trim().Equals("")) { WebMsgBox.Show("Reenter Password not null !"); txtUsername.Focus(); return; } if (txtPassword.Text != txtReenterPassword.Text) { WebMsgBox.Show("Password not same !"); txtUsername.Focus(); return; } if (txtCard.Text.Trim().Equals("")) { WebMsgBox.Show("Credit Card not null !"); txtCard.Focus(); return; } if (txtName.Text.Trim().Equals("")) { WebMsgBox.Show("Full Name not null !"); txtName.Focus(); return; } if (txtBirth.Text.Trim().Equals("")) { WebMsgBox.Show("Birth not null !"); txtBirth.Focus(); return; } if (txtAddress.Text.Trim().Equals("")) { WebMsgBox.Show("Address not null !"); txtAddress.Focus(); return; } if (txtPhone.Text.Trim().Equals("")) { WebMsgBox.Show("Phone not null !"); txtPhone.Focus(); return; } if (txtEmail.Text.Trim().Equals("")) { WebMsgBox.Show("Email !"); txtEmail.Focus(); return; } if (!reg.IsMatch(txtEmail.Text)) { WebMsgBox.Show("Not a valid email!"); txtEmail.Focus(); return; } #endregion try { var obj = new CustomerInfo(); obj.Username = txtUsername.Text; obj.Password = passEncode; obj.CreditCard = txtCard.Text; obj.FullName = txtName.Text; obj.Bod = txtBirth.Text; obj.Address = txtAddress.Text; obj.Phone = txtPhone.Text; obj.Email = txtEmail.Text; obj.Avata = txtAvata.Text; obj.Status = chkActive.Checked ? "1" : "0"; CustomerService.Customer_Insert(obj); Response.Redirect("Login.aspx"); txtUsername.Text = txtCard.Text = txtName.Text = txtAddress.Text = txtPhone.Text = txtEmail.Text = ""; } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnSignInMobile_Click(object sender, EventArgs e) { try { SQLProcs sqlobj = new SQLProcs(); DataSet dsChkAct = new DataSet(); DataSet dsChkPwd = new DataSet(); DataSet dsChkSt = new DataSet(); DataSet dsChkPwdDt = new DataSet(); Session["UserID"] = string.Empty; //Check User //dsChkAct = sqlobj.SQLExecuteDataset("SP_CheckUser", // new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, // new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); dsChkAct = sqlobj.SQLExecuteDataset("proc_LoginCheck", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); if (dsChkAct != null && dsChkAct.Tables.Count > 0 && dsChkAct.Tables[0].Rows.Count > 0) { //Check Status //dsChkSt = sqlobj.SQLExecuteDataset("SP_CheckStatus", // new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, // new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); if (dsChkAct.Tables[0].Rows.Count != 0) { dsChkPwd = sqlobj.SQLExecuteDataset("SP_CheckUIPwd", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); if (dsChkPwd.Tables[0].Rows.Count == 0) { //Session["UserID"] = txtUserID.Text.Trim(); Session["UserID"] = dsChkAct.Tables[0].Rows[0]["UserID"].ToString(); Session["Action"] = "LogIn"; InsertLoginAudit(); InsertUsageLog(); //Response.Redirect("ManageNTaskList.aspx?UserName="******"UserID"].ToString()); //Response.Redirect("Home.aspx"); Response.Redirect("MHome.aspx"); return; } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Function", "NavigateDir2();", true); return; } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: User is Terminated/Blocked"); //msgbox.ShowError("Access Denied: User is Terminated/Blocked"); } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: Invalid User ID / Password"); return; } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnPost_Click(object sender, EventArgs e) { try { int tmp = 0; string SetNo = "", RefId = ""; double DrAmount = 0; if (txtBrCode.Text.ToString() == "") { txtBrCode.Focus(); WebMsgBox.Show("Enter branch code first", this.Page); return; } else if (txtProdCode.Text.ToString() == "") { txtProdCode.Focus(); WebMsgBox.Show("Enter procudt code first", this.Page); return; } else if (txtAsOnDate.Text.ToString() == "") { txtAsOnDate.Focus(); WebMsgBox.Show("Enter as on date first", this.Page); return; } else if (txtProdCode2.Text.ToString() == "") { txtProdCode2.Focus(); WebMsgBox.Show("Enter product code first ...!!", this.Page); return; } else { //DT = CreateFirst(DT); SetNo = BD.GetSetNo(Session["EntryDate"].ToString(), "DaySetNo", Session["BRCD"].ToString()).ToString(); RefId = BD.GetMaxRefid(Session["BRCD"].ToString(), Session["EntryDate"].ToString(), "REFID"); ViewState["RefId"] = (Convert.ToInt32(RefId) + 1).ToString(); foreach (GridViewRow gvRow in grdDevident.Rows) { if (((CheckBox)gvRow.FindControl("chk")).Checked) { Result = DP.InsertData(txtBrCode.Text.ToString(), txtProdCode2.Text.ToString(), txtAsOnDate.Text.ToString(), SetNo, ((Label)gvRow.FindControl("lblSrNum")).Text, Session["MID"].ToString()); DT = DP.DrInsertData(txtBrCode.Text.ToString(), txtProdCode2.Text.ToString(), txtAsOnDate.Text.ToString(), SetNo, ((Label)gvRow.FindControl("lblSrNum")).Text, Session["MID"].ToString()); DrAmount = Convert.ToDouble(DrAmount.ToString()) + Convert.ToDouble(Convert.ToDouble(DT.Rows[0]["Total"].ToString()) < 0 ? "0" : DT.Rows[0]["Total"].ToString()); //DT.Rows.Add(txtBrCode.Text.ToString(), Session["EntryDate"].ToString(), ((Label)gvRow.FindControl("lblGlcode")).Text, ((Label)gvRow.FindControl("lblSubglcode")).Text, // ((Label)gvRow.FindControl("lblAccNo")).Text, ((Label)gvRow.FindControl("lblCustNo")).Text, ((Label)gvRow.FindControl("lblCustName")).Text, // ((Label)gvRow.FindControl("lblBalance")).Text, ((Label)gvRow.FindControl("lblIMSBalance")).Text, ((Label)gvRow.FindControl("lblAGMBalance")).Text, // txtProdCode2.Text.ToString()); //if (Result > 0) //{ // Result = DP.Authorized(DT.Rows[tmp]["BrCode"].ToString(), DT.Rows[tmp]["EntryDate"].ToString(), DT.Rows[tmp]["SubGlCode2"].ToString(), DT.Rows[tmp]["SubGlCode2"].ToString(), "0", // "Divident Acc BrCode " + txtBrCode.Text.ToString() + "/" + DT.Rows[tmp]["SubGlCode"].ToString() + "", "", DT.Rows[tmp]["Balance"].ToString(), "1", "7", "TRF", SetNo, "1003", // Session["MID"].ToString(), "0", Session["MID"].ToString(), "PAYDIV", DT.Rows[tmp]["CustNo"].ToString(), DT.Rows[tmp]["CustName"].ToString(), ViewState["RefId"].ToString()); //} tmp++; } } if (Result > 0) { Result = DP.InsertData_DR(txtBrCode.Text.ToString(), txtProdCode2.Text.ToString(), txtAsOnDate.Text.ToString(), SetNo, "0", Session["MID"].ToString(), DrAmount.ToString()); ClearAllData(); txtProdCode.Focus(); WebMsgBox.Show("Successfully Posted with set no : " + SetNo, this.Page); CLM.LOGDETAILS("Insert", Session["BRCD"].ToString(), Session["MID"].ToString(), "Divident_Transfer_SetNo" + SetNo + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString()); return; } } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
protected void btnHidden_Click(object sender, EventArgs e) { DataSet dsBalance = sqlobj.SQLExecuteDataset("SP_GetBalance"); if (dsBalance.Tables[0].Rows.Count > 0) { decimal creditlimit = Convert.ToDecimal(dsBalance.Tables[0].Rows[0]["CreditLimit"].ToString()); decimal AvailableBalance = Convert.ToDecimal(dsBalance.Tables[0].Rows[0]["CreditBalance"].ToString()); //decimal AvailableBalance = -230; if (AvailableBalance < creditlimit) { Response.Redirect("PayDetails.aspx", false); } else { if ((AvailableBalance < 0) && (AvailableBalance > creditlimit)) { // WebMsgBox.Show("Please recharge quickly to avoid disconnecting."); Session["AlertMsg"] = "Please recharge quickly to avoid disconnecting"; } DataSet dsdebitamount = sqlobj.SQLExecuteDataset("SP_DayUsageBilling"); dsdebitamount.Dispose(); DataSet dsCompanyDetails = sqlobj.SQLExecuteDataset("SP_GetCompanyDetails"); if (dsCompanyDetails.Tables[0].Rows.Count != 0) { string strproductname = dsCompanyDetails.Tables[0].Rows[0]["productname"].ToString(); if (strproductname != "") { DataSet dsChkAct = sqlobj.SQLExecuteDataset("proc_LoginCheck", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = Session["SUPASSWORD"].ToString() }); if (dsChkAct != null && dsChkAct.Tables.Count > 0 && dsChkAct.Tables[0].Rows.Count > 0) { ////Check Status //dsChkSt = sqlobj.SQLExecuteDataset("SP_CheckStatus", // new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, // new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = txtPlainPassword.Text }); if (dsChkAct.Tables[0].Rows.Count != 0) { DataSet dsChkPwd = sqlobj.SQLExecuteDataset("SP_CheckUIPwd", new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = txtUserID.Text }, new SqlParameter() { ParameterName = "@Password", SqlDbType = SqlDbType.NVarChar, Value = Session["SUPASSWORD"].ToString() }); if (dsChkPwd.Tables[0].Rows.Count == 0) { //Session["UserID"] = txtUserID.Text.Trim(); Session["UserID"] = dsChkAct.Tables[0].Rows[0]["UserID"].ToString(); Session["Action"] = "LogIn"; InsertLoginAudit(); InsertUsageLog(); FormsAuthentication.RedirectFromLoginPage(txtUserID.Text, false); return; } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Function", "NavigateDir2();", true); return; } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: User is Terminated/Blocked"); //msgbox.ShowError("Access Denied: User is Terminated/Blocked"); } } else { Session["UserID"] = txtUserID.Text; Session["Action"] = "Failed"; InsertLoginAudit(); WebMsgBox.Show("Access Denied: Invalid User ID / Password"); return; } } else { WebMsgBox.Show("OOPS! Something is broken! Contact the dealer from whom you bought the software license."); } } } } dsBalance.Dispose(); }
protected void btnSave_Click(object sender, EventArgs e) { if (CnfResult.Value == "true") { try { // GetMax Code string strpscode = ""; DataSet dsGetMax = sqlobj.ExecuteSP("SP_GetMaxCodeforAPS"); if (dsGetMax.Tables[0].Rows.Count > 0) { string code = dsGetMax.Tables[0].Rows[0]["PSCode"].ToString(); string[] strgetcode = code.Split('/'); int iIncrement = Convert.ToInt32(strgetcode[1].ToString()) + 1; strpscode = "PS/" + iIncrement.ToString("000"); } else { strpscode = "PS/001"; } int count = 0; foreach (GridDataItem item in rgPhysicalStock.MasterTableView.Items) { if (item.Selected) { count = count + 1; } } if (count > 0) { foreach (GridDataItem item in rgPhysicalStock.MasterTableView.Items) { if (item.Selected) { string strassetcode = item["AssetCode"].Text.ToString(); string strassetname = item["AssetName"].Text.ToString(); string strtype = item["AssetType"].Text.ToString(); sqlobj.ExecuteSQLNonQuery("SP_InsertAssetStock", new SqlParameter() { ParameterName = "@PSCode", SqlDbType = SqlDbType.NVarChar, Value = strpscode.ToString() }, new SqlParameter() { ParameterName = "@Date", SqlDbType = SqlDbType.DateTime, Value = DateTime.Now }, new SqlParameter() { ParameterName = "@DeptCode", SqlDbType = SqlDbType.NVarChar, Value = ddlDepartment.SelectedValue }, new SqlParameter() { ParameterName = "@Type", SqlDbType = SqlDbType.NVarChar, Value = strtype.ToString() }, new SqlParameter() { ParameterName = "@AssetCode", SqlDbType = SqlDbType.NVarChar, Value = strassetcode.ToString() }, new SqlParameter() { ParameterName = "@AssetName", SqlDbType = SqlDbType.NVarChar, Value = strassetname.ToString() }, new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = Session["UserID"].ToString() }); } } Clear(); LoadPhysicalStock(); WebMsgBox.Show("Asset verification details saved"); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Select atleast one item to save physical stock details.');", true); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } } }
protected void BtnSubmit_Click(object sender, EventArgs e) { if (ViewState["Flag"].ToString() == "AD") { //TxtProductId.Text = CS.ProductMaster(FLAG: "GETID"); if (TxtVendorId.Text == "") { //WebMsgBox.Show("Enter Vendor Name ..!!", this.Page); //return ; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Enter Vendor ID ..!!')", true); } if (txtProductNAme.Text == "") { WebMsgBox.Show("Enter Product Name..!!", this.Page); return; } if (TxtRate.Text == "") { WebMsgBox.Show("Enter Rate..!!", this.Page); return; } // if (TxtCGST.Text == "") // { // WebMsgBox.Show("Enter CGST..!!", this.Page); // return; // } // if (txtSGstPrcd.Text == "") // { // WebMsgBox.Show("Enter SGST Product Code..!!", this.Page); // return; // } // if (txtSGST.Text == "") // { // WebMsgBox.Show("Enter SGST..!!", this.Page); // return; // } // if (txtCGDTPROCODE.Text == "") // { // WebMsgBox.Show("Enter CGST Product Code..!!", this.Page); // return; // } try { // sResult = CS.DeadStock("VENDORID", TxtVendorId.Text); // if (sResult == "") //{ sResult = CS.ProductMaster(FLAG: "AD", PRODID: TxtProductId.Text, VENDORID: TxtVendorId.Text.Trim(), PRODNAME: txtProductNAme.Text, RATE: TxtRate.Text, SGST: txtSGST.Text, CGST: TxtCGST.Text, SGSTPRD: txtSGstPrcd.Text, CGSTPRD: txtCGDTPROCODE.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString()); // if (sResult.StartsWith("AD#")) { string[] Array = sResult.Split('#'); string title = sResult.Replace("\n", " ");; string body = "Welcome to ASPSnippets.com"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Popup", "ShowPopup('Product " + Array[1] + " " + Array[2] + " Create Succefully!');", true); Clear1(); SHOWUNAUTHORIZE(); } else if (sResult == "ALREADYEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Product Already Present!')", true); Clear1(); } else if (sResult.StartsWith("ERROR")) { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Try Again!')", true); } // } if (sResult == "NOTAUTH") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Vendor Not Authorize!')", true); TxtVendorId.Text = ""; } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } else if (ViewState["Flag"].ToString() == "MD") { try { sResult = CS.ProductMaster(FLAG: "MD", PRODID: TxtProductId.Text, VENDORID: TxtVendorId.Text.Trim(), PRODNAME: txtProductNAme.Text, RATE: TxtRate.Text, SGST: txtSGST.Text, CGST: TxtCGST.Text, SGSTPRD: txtSGstPrcd.Text, CGSTPRD: txtCGDTPROCODE.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString()); // if (sResult.StartsWith("MD#")) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Modify Successfully!')", true); Clear(); SHOWUNAUTHORIZE(); } else if (sResult == "NOTEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Product Not Present!')", true); // Clear(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Try Again!')", true); Clear(); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } else if (ViewState["Flag"].ToString() == "ATH") { try { sResult = CS.ProductMaster(FLAG: "ATH", PRODID: TxtProductId.Text, VENDORID: TxtVendorId.Text.Trim(), PRODNAME: txtProductNAme.Text, RATE: TxtRate.Text, SGST: txtSGST.Text, CGST: TxtCGST.Text, SGSTPRD: txtSGstPrcd.Text, CGSTPRD: txtCGDTPROCODE.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString()); // if (sResult.StartsWith("ATH#")) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Authorize Successfully!')", true); Clear(); SHOWUNAUTHORIZE(); } else if (sResult == "NOTEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Vendor Not Present!')", true); Clear(); } else if (sResult == "NOTAUTH") { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('You Are Not Authorize Person!')", true); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } else if (ViewState["Flag"].ToString() == "DEL") { try { sResult = CS.ProductMaster(FLAG: "DEL", PRODID: TxtProductId.Text, VENDORID: TxtVendorId.Text.Trim(), PRODNAME: txtProductNAme.Text, RATE: TxtRate.Text, SGST: txtSGST.Text, CGST: TxtCGST.Text, SGSTPRD: txtSGstPrcd.Text, CGSTPRD: txtCGDTPROCODE.Text, ENTRYDATE: Session["EntryDate"].ToString(), MID: Session["MID"].ToString()); // if (sResult.StartsWith("DEL#")) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Delete Successfully!')", true); Clear(); SHOWUNAUTHORIZE(); } else if (sResult == "NOTEXISTS") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Vendor Not Present!')", true); Clear(); } else if (sResult == "ALREADYPRODMAST") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Already Vendor Product Exists!')", true); Clear(); } else { // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Please Try Again!!!!!');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Try Again!')", true); } } catch (Exception EX) { WebMsgBox.Show(EX.Message.ToString(), this.Page); ExceptionLogging.SendErrorToText(EX); } } }
protected void rgUpdatePhysicalStock_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName == "UpdateRow") { if (e.Item is GridDataItem) { GridDataItem ditem = (GridDataItem)e.Item; //LinkButton lblpscode = (LinkButton)e.Item.FindControl("lbtnUpdate"); string strpscode = e.CommandArgument.ToString(); string batchdate = ditem["Date"].Text; Session["PSCode"] = strpscode.ToString(); Session["BatchDate"] = batchdate.ToString(); DataSet dsRes = sqlobj.ExecuteSP("SP_GetAssetPhysicalStock", new SqlParameter() { ParameterName = "@PSCode", SqlDbType = SqlDbType.NVarChar, Value = strpscode.ToString() }); if (dsRes.Tables[0].Rows.Count > 0) { rgUpdateStock.DataSource = dsRes; rgUpdateStock.DataBind(); dvUpdatePhysicalStock.Visible = false; dvUpdateStock.Visible = true; lblPSCode.Text = Session["PSCode"].ToString(); lblDate.Text = Session["BatchDate"].ToString(); } else { rgUpdateStock.DataSource = string.Empty; rgUpdateStock.DataBind(); dvUpdatePhysicalStock.Visible = true; dvUpdateStock.Visible = false; lblPSCode.Text = ""; //dvUpdatePhysicalStock.Visible = ; } } } else if (e.CommandName == "PSVR1") { if (e.Item is GridDataItem) { GridDataItem ditem = (GridDataItem)e.Item; //LinkButton lblpscode = (LinkButton)e.Item.FindControl("lbtnUpdate"); string strpscode = e.CommandArgument.ToString(); string batchdate = ditem["Date"].Text; Session["PSCode"] = strpscode.ToString(); Session["BatchDate"] = batchdate.ToString(); } string pscode = e.CommandArgument.ToString(); PSVR1(pscode); } else if (e.CommandName == "PSVR2") { if (e.Item is GridDataItem) { GridDataItem ditem = (GridDataItem)e.Item; //LinkButton lblpscode = (LinkButton)e.Item.FindControl("lbtnUpdate"); string strpscode = e.CommandArgument.ToString(); string batchdate = ditem["Date"].Text; Session["PSCode"] = strpscode.ToString(); Session["BatchDate"] = batchdate.ToString(); } string pscode = e.CommandArgument.ToString(); PSVR2(pscode); } else { LoadPhysicalStock(); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnAddEvent_Click(object sender, EventArgs e) { try { if (CnfResult.Value == "true") { string filename = string.Empty; String File = ""; //if (FileUpd.HasFile) //{ // if (FileUpd.PostedFile.FileName.Length > 0) // { // filename = Path.GetFileName(FileUpd.PostedFile.FileName); // FileUpd.SaveAs(Server.MapPath(@"~//EventImages/") + DateTime.Now.ToString("ddmmyyhhmmsss") + "_" + filename); // File = (@"~//EventImages/") + DateTime.Now.ToString("ddmmyyhhmmsss") + "_" + filename; // } // else // { // File = ""; // } //} sqlobj.ExecuteNonQuery("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@Fromdate", SqlDbType = SqlDbType.DateTime, Value = FromDate.SelectedDate.Value }, new SqlParameter() { ParameterName = "@Tilldate", SqlDbType = SqlDbType.DateTime, Value = FromDate.SelectedDate.Value }, new SqlParameter() { ParameterName = "@EventName", SqlDbType = SqlDbType.NVarChar, Value = txtEventName.Text }, new SqlParameter() { ParameterName = "@Description", SqlDbType = SqlDbType.NVarChar, Value = txtdesc.Text }, new SqlParameter() { ParameterName = "@EventType", SqlDbType = SqlDbType.NVarChar, Value = "C" }, new SqlParameter() { ParameterName = "@Status", SqlDbType = SqlDbType.NVarChar, Value = "00" }, new SqlParameter() { ParameterName = "@IsSentMail", SqlDbType = SqlDbType.NVarChar, Value = "false" }, new SqlParameter() { ParameterName = "@Images", SqlDbType = SqlDbType.NVarChar, Value = "" } ); DateTime fdate = Convert.ToDateTime(FromDate.SelectedDate.Value); DateTime tdate = Convert.ToDateTime(FromDate.SelectedDate.Value); EventMail(txtEventName.Text, txtdesc.Text, fdate, tdate); LoadGrid(); clear(); WebMsgBox.Show("Calendar added."); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnChange_Click(object sender, EventArgs e) { if (TxtUserId.Text != string.Empty && TxtCurrentPassword.Text != string.Empty && TxtNewpassword.Text != string.Empty && TxtConfirmPwd.Text != string.Empty) { if (TxtNewpassword.Text == TxtConfirmPwd.Text) { try { SqlCommand pwdcmd = new SqlCommand("Get_Currentpwd", con); pwdcmd.CommandType = CommandType.StoredProcedure; pwdcmd.Parameters.AddWithValue("@UserName", TxtUserId.Text); SqlDataAdapter dap = new SqlDataAdapter(pwdcmd); DataSet ds = new DataSet(); dap.Fill(ds, "temp"); if (ds.Tables[0].Rows.Count > 0) { string strcpwd = ds.Tables[0].Rows[0]["Password"].ToString(); if (strcpwd == TxtCurrentPassword.Text) { SqlCommand cmd = new SqlCommand("Porc_UpdatePwd", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserName", TxtUserId.Text); cmd.Parameters.AddWithValue("@CPassword", TxtCurrentPassword.Text); cmd.Parameters.AddWithValue("@UPassword", TxtNewpassword.Text); con.Open(); cmd.ExecuteNonQuery(); con.Close(); WebMsgBox.Show("Password Changed Successfully"); ClearScr(); Response.Redirect("~/Login.aspx"); } else { WebMsgBox.Show("Please check your current password"); TxtCurrentPassword.Text = string.Empty; TxtNewpassword.Text = string.Empty; TxtConfirmPwd.Text = string.Empty; } } else { WebMsgBox.Show("Please check your current password"); TxtCurrentPassword.Text = string.Empty; TxtNewpassword.Text = string.Empty; TxtConfirmPwd.Text = string.Empty; } //SqlProcsNew sqlobj = new SqlProcsNew(); //DataSet ds = new DataSet(); //ds = sqlobj.ExecuteSP("SP_GETPASSWORDDETAILS", // new SqlParameter() { ParameterName = "@IMODE", SqlDbType = SqlDbType.NVarChar, Value = 1 }, // new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = TxtUserId.Text }, // new SqlParameter() { ParameterName = "@PWD", SqlDbType = SqlDbType.NVarChar, Value = TxtCurrentPassword.Text } // ); //if (ds != null && ds.Tables[0].Rows.Count > 0) //{ // if (ds.Tables[0].Rows.Count == 0) // { // WebMsgBox.Show("Kindly check your User ID."); // return; // } // if (TxtCurrentPassword.Text == ds.Tables[0].Rows[0]["UPassword"].ToString()) // { // sqlobj.ExecuteSQLNonQuery("SP_CHANGEPASSWORD", // new SqlParameter() { ParameterName = "@IMODE", SqlDbType = SqlDbType.NVarChar, Value = 1 }, // new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.NVarChar, Value = Convert.ToInt32(ds.Tables[0].Rows[0]["RSN"]) }, // new SqlParameter() { ParameterName = "@PWD", SqlDbType = SqlDbType.NVarChar, Value = TxtConfirmPwd.Text } // ); // WebMsgBox.Show("Password Changed Successfully"); // ClearScr(); // } // else // { // WebMsgBox.Show("Kindly check your current password"); // return; // } //} } catch (Exception ex) { WebMsgBox.Show(ex.Message); } } else { WebMsgBox.Show("Error! New password and Confirm Password do not match. Please re-enter."); } } else { WebMsgBox.Show("Enter Mandatory Field"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { if (CnfResult.Value == "true") { //string filename = Path.GetFileName(FileUpd.FileName); String File; //string strfile = ""; //if (!FileUpd.HasFile) //{ // File = TxtImge.Text; //} //else //{ // strfile = DateTime.Now.ToString("ddmmyyhhmmsss") + "_" + filename; // File = (@"~//EventImages/") + strfile.ToString(); //} //FileUpd.SaveAs(Server.MapPath(@"~//EventImages/") + strfile.ToString()); string rsn = Session["RSN"].ToString(); sqlobj.ExecuteNonQuery("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 3 }, new SqlParameter() { ParameterName = "@Fromdate", SqlDbType = SqlDbType.DateTime, Value = FromDate.SelectedDate.Value }, new SqlParameter() { ParameterName = "@Tilldate", SqlDbType = SqlDbType.DateTime, Value = FromDate.SelectedDate.Value }, new SqlParameter() { ParameterName = "@EventName", SqlDbType = SqlDbType.NVarChar, Value = txtEventName.Text }, new SqlParameter() { ParameterName = "@Description", SqlDbType = SqlDbType.NVarChar, Value = txtdesc.Text }, new SqlParameter() { ParameterName = "@EventType", SqlDbType = SqlDbType.NVarChar, Value = "C" }, new SqlParameter() { ParameterName = "@Status", SqlDbType = SqlDbType.NVarChar, Value = "00" }, new SqlParameter() { ParameterName = "@IsSentMail", SqlDbType = SqlDbType.NVarChar, Value = "false" }, new SqlParameter() { ParameterName = "@Images", SqlDbType = SqlDbType.NVarChar, Value = "" }, new SqlParameter() { ParameterName = "@Remarks", SqlDbType = SqlDbType.NVarChar, Value = "" }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.NVarChar, Value = Session["RSN"].ToString() } ); LoadGrid(); clear(); WebMsgBox.Show("Calendar details updated successfully"); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnExecution_Click(object sender, EventArgs e) { //if (rdbAll.Checked == true) //{ // FL = "All"; // if (txtFromDate.Text == "") // { // WebMsgBox.Show("Please enter from Date.", this.Page); // } // if (txtFromDate.Text == "") // { // WebMsgBox.Show("Please enter To Date.", this.Page); // } // if (rbtSep.Checked == false && rdbAll.Checked == false) // { // WebMsgBox.Show("Please Select Item.", this.Page); // } // if (DDLSTAGE.SelectedValue == "0") // { // WebMsgBox.Show("Please Select stage.", this.Page); // } //} //if (rbtSep.Checked == true) //{ // FL = "Specific"; // if (txtTsro.Text == "") // { // WebMsgBox.Show("Please enter From SRNO.", this.Page); // } // if (txtFsro.Text == "") // { // WebMsgBox.Show("Please enter To SRNO.", this.Page); // } // if (txtFromDate.Text == "") // { // WebMsgBox.Show("Please enter from Date.", this.Page); // } // if (txtFromDate.Text == "") // { // WebMsgBox.Show("Please enter To Date.", this.Page); // } // if (DDLSTAGE.SelectedValue == "0") // { // WebMsgBox.Show("Please Select stage.", this.Page); // } //} //DataTable dt = new DataTable(); //dt = SRO.RptEXECUSIONMONTHLYRPTS(FL, txtFromDate.Text, txtToDate.Text, txtFsro.Text, txtTsro.Text,DDLSTAGE.SelectedValue.ToString()); ////dt = SRO.RptSRNOMONTHLYRPTS(flag:FL,FDATE:txtFromDate.Text,TDATE:txtToDate.Text,FSRNO:txtFsro.Text,TSRNO:txtTsro.Text); //GridView gv2 = new GridView(); //gv2.DataSource = dt; //gv2.DataBind(); //Response.Clear(); //Response.AddHeader("content-disposition", "attachment;filename=eXECUTIONREPORT.xls"); //Response.ContentType = "application/vnd.ms-excel"; //StringWriter sw = new StringWriter(); //HtmlTextWriter hw = new HtmlTextWriter(sw); //gv2.RenderControl(hw); //Response.Output.Write(sw.ToString()); //Response.End(); if (rdbAll.Checked == true) { FL = "All"; if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter from Date.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter To Date.", this.Page); } if (rbtSep.Checked == false && rdbAll.Checked == false) { WebMsgBox.Show("Please Select Item.", this.Page); } if (DDLSTAGE.SelectedValue == "0") { WebMsgBox.Show("Please Select stage.", this.Page); } } if (rbtSep.Checked == true) { FL = "Specific"; if (txtTsro.Text == "") { WebMsgBox.Show("Please enter From SRNO.", this.Page); } if (txtFsro.Text == "") { WebMsgBox.Show("Please enter To SRNO.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter from Date.", this.Page); } if (txtFromDate.Text == "") { WebMsgBox.Show("Please enter To Date.", this.Page); } if (DDLSTAGE.SelectedValue == "0") { WebMsgBox.Show("Please Select stage.", this.Page); } } DataTable dt = new DataTable(); dt = SRO.RptEXECUSIONMONTHLYRPTS(FL, txtFromDate.Text, txtToDate.Text, txtFsro.Text, txtTsro.Text, DDLSTAGE.SelectedValue.ToString()); //dt = SRO.RptSRNOMONTHLYRPTS(flag:FL,FDATE:txtFromDate.Text,TDATE:txtToDate.Text,FSRNO:txtFsro.Text,TSRNO:txtTsro.Text); GridView gv2 = new GridView(); gv2.DataSource = dt; gv2.DataBind(); Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=eXECUTIONREPORT.xls"); Response.ContentType = "application/vnd.ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); gv2.RenderControl(hw); Response.Output.Write(sw.ToString()); Response.End(); }
public static void EventMail(string EventName, string Description, DateTime fromeventdate, DateTime toevnetdate) { try { SqlProcsNew sqlobj = new SqlProcsNew(); string tomail = ""; string touser = ""; string title = ""; string AdminName = ""; string AdminContact = ""; DataSet dsAdmin = new DataSet(); dsAdmin = sqlobj.ExecuteSP("GetAdminDetails"); if (dsAdmin != null && dsAdmin.Tables[0].Rows.Count > 0) { AdminName = dsAdmin.Tables[0].Rows[0]["CommunityName"].ToString(); AdminContact = dsAdmin.Tables[0].Rows[0]["FromMobileNo"].ToString(); } DataSet dsemail = sqlobj.ExecuteSP("SP_GetResidentMail"); if (dsemail.Tables[0].Rows.Count > 0) { tomail = dsemail.Tables[0].Rows[0]["Contactmail"].ToString(); touser = dsemail.Tables[0].Rows[0]["RTName"].ToString(); title = dsemail.Tables[0].Rows[0]["RTTitle"].ToString(); dsemail.Dispose(); if (tomail.ToString() != "") { string strmcusername = ""; string strmcpassword = ""; string strmcfromname = ""; DataSet dsmc = sqlobj.ExecuteSP("SP_GetMailCredential"); if (dsmc.Tables[0].Rows.Count > 0) { strmcusername = dsmc.Tables[0].Rows[0]["username"].ToString(); strmcpassword = dsmc.Tables[0].Rows[0]["password"].ToString(); strmcfromname = dsmc.Tables[0].Rows[0]["sentbyuser"].ToString(); } dsmc.Dispose(); MailClass M = new MailClass(); M.EventsMail(strmcusername, strmcfromname, tomail.ToString(), touser.ToString(), touser.ToString(), EventName.ToString(), Description.ToString(), fromeventdate, strmcusername.ToString(), strmcpassword.ToString(), AdminName, AdminContact, AdminContact, title); } } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (CnfResult.Value == "true") { if (drpSubgroup.SelectedValue == "0" || ddlAccountGroup.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Please Select Account Group and Sub Group.');", true); return; } string sAccountCode = "G1" + txtAccountCode.Text; DataSet dsCategory = sqlobj.ExecuteSP("SP_AccountMaster", new SqlParameter() { ParameterName = "@AccountCode", SqlDbType = SqlDbType.NVarChar, Value = sAccountCode.ToString() }, new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 5 }); if (dsCategory.Tables[0].Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Account Code already exists, Please try different Account code');", true); } else { sqlobj.ExecuteSQLNonQuery("SP_AccountMaster", new SqlParameter() { ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 1 }, new SqlParameter() { ParameterName = "@AccountCode", SqlDbType = SqlDbType.NVarChar, Value = sAccountCode.ToString() }, new SqlParameter() { ParameterName = "@AccountName", SqlDbType = SqlDbType.NVarChar, Value = txtAccountName.Text }, new SqlParameter() { ParameterName = "@AccountGroup", SqlDbType = SqlDbType.NVarChar, Value = ddlAccountGroup.SelectedValue }, new SqlParameter() { ParameterName = "@AccountType", SqlDbType = SqlDbType.NVarChar, Value = "G" }, new SqlParameter() { ParameterName = "@SubGrp", SqlDbType = SqlDbType.NVarChar, Value = drpSubgroup.SelectedValue }, new SqlParameter() { ParameterName = "@Remarks", SqlDbType = SqlDbType.NVarChar, Value = txtRemarks.Text }, new SqlParameter() { ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = Session["UserID"].ToString() } ); Clear(); LoadAccountMaster(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('Accounts master details saved');", true); } } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void BtnUpdateAll_Click(object sender, EventArgs e) { try { int Res = 0; int STRRes = 0; ViewState["BtnType"] = "Update"; if (ViewState["Flag"].ToString() == "MD") { InsertData("RC"); //ClearData(); 23-03-2019 } else { if (Chk_AllAutho.Checked == false) { if (ViewState["Flag"].ToString() == "AT") { string FL = ""; //RO.FL = "CMID"; STRRes = RO.GetDivMemPendingListDT_1(GridView1009, Txtfrmbrcd.Text, Txttobrcd.Text, TxtFDate.Text, TxtTDate.Text, FL, DdlAccActivity.SelectedValue, DdlRecDiv.SelectedValue, DdlRecDept.SelectedValue); if (STRRes.ToString() != Session["MID"].ToString()) { //RO.MID = Session["MID"].ToString(); //RO.FL = "SENDAUTHO"; Res = RO.GetDivMemPendingListDT_1(GridView1009, Txtfrmbrcd.Text, Txttobrcd.Text, TxtFDate.Text, TxtTDate.Text, FL, DdlAccActivity.SelectedValue, DdlRecDiv.SelectedValue, DdlRecDept.SelectedValue); if (Res > 0) { WebMsgBox.Show("Authorized Succesfully......!", this.Page); GetTotal(); ClearData(); } else { WebMsgBox.Show("Already authorized......!", this.Page); GetTotal(); ClearData(); } } else { WebMsgBox.Show("Warning :User is restricted to authorize, Change user......!", this.Page); ClearData(); return; } } ClearData(); } else if (Chk_AllAutho.Checked == true) // For All Auhtorize at a time { if (ViewState["Flag"].ToString() == "AT") { string FL = "AUTH"; Res = RO.GetDivMemPendingListDT_1(GridView1009, Txtfrmbrcd.Text, Txttobrcd.Text, TxtFDate.Text, TxtTDate.Text, FL, DdlAccActivity.SelectedValue, DdlRecDiv.SelectedValue, DdlRecDept.SelectedValue); if (Res > 0) { WebMsgBox.Show("Authorized Succesfully......!", this.Page); ClearData(); } else { WebMsgBox.Show("Already authorized......!", this.Page); ClearData(); } } } } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (FileUpload1.HasFile) { Byte[] imgbyte = null; string strname = FileUpload1.FileName.ToString(); string ext = Path.GetExtension(strname); string contenttype = String.Empty; HttpPostedFile File = FileUpload1.PostedFile; imgbyte = new Byte[File.ContentLength]; File.InputStream.Read(imgbyte, 0, File.ContentLength); //FileUpload1.PostedFile.SaveAs(Server.MapPath("~/upload/") + strname); switch (ext) { case ".jpg": contenttype = "image/jpg"; break; case ".jpeg": contenttype = "image/jpeg"; break; case ".gif": contenttype = "image/gif"; break; case ".png": contenttype = "image/png"; break; case ".bmp": contenttype = "image/bmp"; break; case ".tif": contenttype = "image/tif"; break; } if (contenttype != String.Empty) { Stream fs = FileUpload1.PostedFile.InputStream; BinaryReader br = new BinaryReader(fs); Byte[] bytes = imgbyte; //br.ReadBytes((Int32)fs.Length); string BRCD = Session["BRCD"].ToString(); string Mid = Session["MID"].ToString(); SqlConnection conn = new SqlConnection(conn1.DbName()); SqlCommand cmd = new SqlCommand("INSERT INTO AVS1011(CUSTNO, ACCNO, SUBGLCODE, SRNO, DATEOFUPLOAD, STAGE, PHOTOSTATUS, RTIME, BRCD, MID, PCMAC, PHOTO,photo_type) VALUES " + "(@CustNo,@AccNo,@SubGlCode,@SrNo,@Date,@Stage, @PStatus,@Rtrim,@BranchCode, @MCode,@PCMac, @Data,@ImageType)", conn); cmd.Parameters.Add("@CustNo", SqlDbType.Int).Value = Txtcustno.Text; cmd.Parameters.Add("@AccNo", SqlDbType.Int).Value = "0"; cmd.Parameters.Add("@SubGlCode", SqlDbType.Int).Value = "0"; cmd.Parameters.Add("@SrNo", SqlDbType.Int).Value = "0"; cmd.Parameters.Add("@Date", SqlDbType.DateTime).Value = conn1.ConvertDate(Session["EntryDate"].ToString()); cmd.Parameters.Add("@Stage", SqlDbType.VarChar).Value = "1001"; cmd.Parameters.Add("@PStatus", SqlDbType.VarChar).Value = "1001"; cmd.Parameters.Add("@Rtrim", SqlDbType.VarChar).Value = ""; cmd.Parameters.Add("@BranchCode", SqlDbType.Int).Value = BRCD; cmd.Parameters.Add("@MCode", SqlDbType.Int).Value = Mid; cmd.Parameters.Add("@Cid", SqlDbType.VarChar).Value = ""; cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes; cmd.Parameters.Add("@PCMac", SqlDbType.VarChar).Value = conn1.PCNAME(); cmd.Parameters.Add("@ImageType", SqlDbType.NVarChar).Value = ddlDocType.SelectedValue.ToString(); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); WebMsgBox.Show("File Uploaded Successfully", this.Page); Txtcustname.Text = ""; Txtcustno.Text = ""; } else { WebMsgBox.Show("File format not support select only jpg/png/gif/jpeg/bmp formats", this.Page); } } else { WebMsgBox.Show("Plz Select the image first !!!!", this.Page); } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
protected void Button1_Click(object sender, EventArgs e) { decryptdata(); decryptpassword = dd; string cc; cc = Decryptdata(decryptpassword); strpassword = Encryptdata(TxtNewPassword.Text); if (Page.IsValid == true) { if (TxtOldPassword.Text == "") { MyClass.MyAlert(this, "Enter old password.", ""); return; } if (txtUserName.Text == "") { MyClass.MyAlert(this, "Enter UserName.", ""); return; } if (TxtNewPassword.Text == "") { MyClass.MyAlert(this, "Enter new password.", ""); return; } if (TxtNewPassword.Text != TxtConfirmPassword.Text) { MyClass.MyAlert(this, "New and confirm Password are not match.", ""); return; } if (cc == TxtOldPassword.Text) { //check for old password //check login SqlConnection con = new SqlConnection(); using (con = DBclass.GetConnection()) { SqlDataReader dr; string sqlstr = ("select * FROM UserIDInfo where User_LoginId = '" + txtUserName.Text + "' and Password='******'"); dr = DBclass.GetDatareader(sqlstr); if (dr.HasRows) { dr.Read(); string sqlst = "Update UserIDInfo Set Password='******' where User_LoginId='" + txtUserName.Text + "' and Password='******'"; SqlCommand cmd = new SqlCommand(sqlst, con); cmd.ExecuteNonQuery(); this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script language=\"javaScript\">" + "alert('Password changed successfully!');" + "window.location.href='LoginDefault.aspx';" + "<" + "/script>"); } else { MyClass.MyAlert(this, "Login Failed, check your email id and password.", ""); return; } } } else { WebMsgBox.Show("Please Enter your Correct Password!"); this.Response.Redirect("changepassword.aspx"); } } }