public bool Delete(RequisitionProvider provider) { bool IsDelete = false; try { SqlCommand command = new SqlCommand(); this.ConnectionOpen(); command.Connection = Connection; this.BeginTransaction(true); command.Transaction = this.Transaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = StoredProcedureNames.RequisitionSet; command.Parameters.Add("@ID", SqlDbType.Int).Value = provider.ID; command.Parameters.Add("@Option", SqlDbType.Int).Value = DBConstants.DataModificationOption.Delete; command.ExecuteNonQuery(); this.CommitTransaction(); this.ConnectionClosed(); IsDelete = true; } catch (Exception exp) { this.RollbackTransaction(); throw new Exception(exp.Message); } finally { this.ConnectionClosed(); } return(IsDelete); }
protected void ddlProductDivision_SelectedIndexChanged(object sender, EventArgs e) { int codeOrName = 0; int productType = 0; int divisionID = 0; Session["Value"] = ddlProductDivision.SelectedValue; RadioButtonList rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName"); RadioButtonList rbProductType = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType"); codeOrName = Convert.ToInt32(rbProductCodeName.SelectedValue); productType = Convert.ToInt32(rbProductType.SelectedValue); divisionID = Convert.ToInt16(ddlProductDivision.SelectedValue); LoadProduct(codeOrName, productType, divisionID); // Load Requistion References ddlRequistionRef.Items.Clear(); RequisitionProvider requisitionProvider = new RequisitionProvider(); string filterExpression = "R.DivisionID = " + divisionID + " "; DataSet ds = requisitionProvider.GetDivisioinWiseRequisitionNo(filterExpression); ddlRequistionRef.DataSource = ds; ddlRequistionRef.DataBind(); ddlRequistionRef.Items.Insert(0, new ListItem("----------Select Product----------", "0")); ddlRequistionRef.SelectedIndex = 0; }
protected void btnShowReqInfo_Click(object sender, EventArgs e) { RequisitionProvider requisitionProvider = new RequisitionProvider(); AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct"); DataTable dt = requisitionProvider.GetRequisitionwisePOInfo(ddlProductValidation.SelectedValue.Toint()); lblProductNameDisplay.Text = ddlProductValidation.SelectedItem.Text; gvReqPOInfo.DataSource = dt; gvReqPOInfo.DataBind(); }
protected void ddlRequistionRef_SelectedIndexChanged(object sender, EventArgs e) { string requisitionAndDate = ddlRequistionRef.SelectedItem.Text; string[] splitValue = requisitionAndDate.Split(' '); string requisitionRefNo = splitValue[0]; RequisitionProvider requisitionProvider = new RequisitionProvider(); DataTable dt = requisitionProvider.GetByID(requisitionRefNo); lvRequisitionProduct.DataSource = dt; lvRequisitionProduct.DataBind(); }
protected void ddlRequisitionDivision_SelectedIndexChanged(object sender, EventArgs e) { ddlRequistionRef.Items.Clear(); RequisitionProvider requisitionProvider = new RequisitionProvider(); int divisionID = ddlRequisitionDivision.SelectedValue.Toint(); //string filterExpression = "R.DivisionID = " + "'" + divisionID + "'";//+ "ORDER BY ProductName"; string filterExpression = "R.DivisionID = " + "" + divisionID + "";//+ "ORDER BY ProductName"; DataSet ds = requisitionProvider.GetDivisioinWiseRequisitionNo(filterExpression); ddlRequistionRef.DataSource = ds; ddlRequistionRef.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AddBlankRowTogvPurchaseProduct(); btnSave.Enabled = true; txtRequisitionDate.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now); } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (Request["__EVENTTARGET"] == "SearchPriceSetup") { var requisitionProvider = new RequisitionProvider(); string code = Request["__EVENTARGUMENT"]; DataTable dt = requisitionProvider.GetByID(code); if (dt.IsNotNull()) { try { for (int k = 0; k < dt.Rows.Count; k++) { txtRequisitionDate.Text = Convert.ToDateTime(dt.Rows[k][3]).ToString("dd/MM/yyyy"); txtRefNo.Text = dt.Rows[k][2].ToString(); ddlRequisitionDivision.SelectedValue = dt.Rows[k][1].ToString(); ckbOption.SelectedValue = dt.Rows[k]["StatusID"].ToString(); } } catch (Exception ex) { throw (ex); } } gvRequisition.DataSource = dt; gvRequisition.DataBind(); btnSave.Visible = false; btnUpdate.Visible = true; } } //string user = Session["UserID"]; if (ckbOption.SelectedValue.Toint() == 3 && Session[SessionConstants.IsAdmin].ToString() == "False") { txtRefNo.Enabled = false; txtRequisitionDate.Enabled = false; ddlRequisitionDivision.Enabled = false; gvRequisition.Enabled = false; btnAdd.Enabled = false; btnUpdate.Enabled = false; } Session["Value"] = ddlRequisitionDivision.SelectedValue; }
private SqlCommand ProcedureFunction(RequisitionProvider provider) { SqlCommand command = new SqlCommand(); this.ConnectionOpen(); command.Connection = Connection; this.BeginTransaction(true); command.Transaction = this.Transaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = StoredProcedureNames.RequisitionSet; command.Parameters.Add("@TransactionNo", SqlDbType.VarChar).Value = provider.TransactionNo; command.Parameters.Add("@ReferenceNo", SqlDbType.VarChar).Value = provider.ReferenceNo; command.Parameters.Add("@RequisitionDate", SqlDbType.DateTime).Value = provider.RequisitionDate; command.Parameters.Add("@DivisionID", SqlDbType.VarChar).Value = provider.DivisionID; return(command); }
protected void btnSave_Click(object sender, EventArgs e) { mode = "Save"; string permisionMessage = CheckUserAuthentication(mode); if (ckbOption.SelectedValue != "") { statusMessage = CheckUserAuthentication(ckbOption.SelectedItem.ToString()); } if (String.IsNullOrEmpty(permisionMessage) && string.IsNullOrEmpty(statusMessage)) { bool msg = false; string message = string.Empty; string transactionNo = string.Empty; try { RequisitionProvider requisitionProvider = RequisitionInfoEntity(); List <RequisitionDetailProvider> requisitionDetailList = requisitionDetailEntityList(); if ((requisitionDetailList == null) || (requisitionDetailList.Count == 0)) { MessageHelper.ShowAlertMessage("Please select at least one product for purchase"); return; } msg = requisitionProvider.Save(requisitionDetailList, out transactionNo); } catch (Exception ex) { message = ex.Message; } if (msg) { Clear(); txtRefNo.Text = transactionNo; this.AlertSuccess(lblMsg, MessageConstants.Saved); } else { MessageHelper.ShowAlertMessage(message); } } else { MessageHelper.ShowAlertMessage(permisionMessage + statusMessage); } }
private RequisitionProvider RequisitionInfoEntity() { RequisitionProvider entity = null; entity = new RequisitionProvider { ReferenceNo = txtRefNo.Text, TransactionDate = DateTime.ParseExact(txtRequisitionDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture), RequisitionDate = DateTime.ParseExact(txtRequisitionDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture), DivisionID = int.Parse(ddlRequisitionDivision.SelectedValue), StatusID = ckbOption.SelectedValue.Toint(), EntryUserID = Convert.ToInt16(Session["ID"]), UpdateUserID = Convert.ToInt16(Session["ID"]) }; if (entity.StatusID == 2) { entity.CheckUserID = Convert.ToInt16(Session["ID"]); } if (entity.StatusID == 3) { entity.ApproveUserID = Convert.ToInt16(Session["ID"]); } return(entity); }
public bool Update(RequisitionProvider RequisitionProvider, List <RequisitionDetailProvider> RequisitionDetailProviderList) { bool IsUpdate = false; try { SqlCommand command = new SqlCommand(); this.ConnectionOpen(); command.Connection = Connection; this.BeginTransaction(true); command.Transaction = this.Transaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = StoredProcedureNames.RequisitionSet; SqlParameter id = new SqlParameter("@ID", SqlDbType.Int); id.Direction = ParameterDirection.Output; command.Parameters.Add(id); command.Parameters.Add("@ReferenceNo", SqlDbType.VarChar).Value = RequisitionProvider.ReferenceNo; command.Parameters.Add("@RequisitionDate", SqlDbType.DateTime).Value = RequisitionProvider.RequisitionDate; command.Parameters.Add("@DivisionID", SqlDbType.VarChar).Value = RequisitionProvider.DivisionID; command.Parameters.Add("@UpdateUserID", SqlDbType.Int).Value = RequisitionProvider.UpdateUserID; command.Parameters.Add("@CheckUserID", SqlDbType.Int).Value = RequisitionProvider.CheckUserID; command.Parameters.Add("@ApproveUserID", SqlDbType.Int).Value = RequisitionProvider.ApproveUserID; command.Parameters.Add("@StatusID", SqlDbType.Int).Value = RequisitionProvider.StatusID; command.Parameters.Add("@Option", SqlDbType.Int).Value = DBConstants.DataModificationOption.Update; command.ExecuteNonQuery(); int RequisitionID = (int)command.Parameters["@ID"].Value; command = new SqlCommand(); command.Connection = Connection; command.Transaction = this.Transaction; command.CommandText = "DELETE FROM dbo.RequisitionDetail WHERE RequisitionID =" + RequisitionID + " "; command.ExecuteNonQuery(); foreach (RequisitionDetailProvider RequisitionDetailsProvider in RequisitionDetailProviderList) { command = new SqlCommand(); command.Connection = Connection; command.Transaction = this.Transaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = StoredProcedureNames.RequisitionDetailSet; command.Parameters.Add("@RequisitionID", SqlDbType.Int).Value = RequisitionID; command.Parameters.Add("@ProductID", SqlDbType.Int).Value = RequisitionDetailsProvider.ProductID; command.Parameters.Add("@RequiredQuantity", SqlDbType.Decimal).Value = RequisitionDetailsProvider.RequiredQuantity; command.Parameters.Add("@MonthlyConsumeQty", SqlDbType.Decimal).Value = RequisitionDetailsProvider.MonthlyConsumeQty; command.Parameters.Add("@Remarks", SqlDbType.VarChar).Value = RequisitionDetailsProvider.Remarks; command.Parameters.Add("@Option", SqlDbType.Int).Value = DBConstants.DataModificationOption.Update; command.ExecuteNonQuery(); } this.CommitTransaction(); this.ConnectionClosed(); IsUpdate = true; } catch (Exception exp) { this.RollbackTransaction(); throw new Exception(exp.Message); } finally { this.ConnectionClosed(); } return(IsUpdate); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt; var reportPath = new ReportPath(); var reportParameter = new ReportParameter(); var reportDocument = new ReportDocument(); int reportType = Request.QueryString["ReportType"].Toint(); DateTime fromDate = Request.QueryString["fromDate"].ToDate(); DateTime toDate = Request.QueryString["toDate"].ToDate(); DateTime aDate = Request.QueryString["aDate"].ToDate(); int reportOption = Request.QueryString["reportOption"].Toint(); int reportCategory = Request.QueryString["reportCategory"].Toint(); int productID = Request.QueryString["productID"].Toint(); var transactionID = Request.QueryString["transactionNo"]; string printOption = Request.QueryString["printOption"]; //******** Updated Datetime ********// DateTime?fDate; DateTime?tDate; DateTime?Date; switch (reportType) { #region Supplier Report case ReportType.SupplierReport: //////////// For Supplier Info report var supplierProvider = new SupplierProvider(); int supplierTypeID = Request.QueryString["SupplierTypeID"].ToInt(); dt = supplierProvider.GetSupplierByTypeID(supplierTypeID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.SupplierReportPath); GetValue(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } break; case ReportType.SupplierProductReport: //////////// For Supplier Product report supplierProvider = new SupplierProvider(); int supplierID = Request.QueryString["SupplierID"].ToInt(); dt = supplierProvider.GetByID(supplierID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.SupplierProductReportPath); GetValue(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion #region Requisition Report case ReportType.RequisitionReport: //////////// For Requisition report var requisitionProvider = new RequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); Date = GetNullaDatetime(); if (reportOption == 3) { var requisitionNo = Request.QueryString["transactionNo"].Trim(); dt = requisitionProvider.GetByID(requisitionNo); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { dt = requisitionProvider.GetAllByDateWise(productID, transactionID, fDate, tDate, Date, reportOption); if (dt != null && dt.Rows.Count > 0) { if (reportOption == 2) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else if (reportOption == 1) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueAGetDate(dt, reportParameter, reportDocument, Date); } } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region Purchase Order Report case ReportType.PurchaseOrderReport: //////////// For Purchase Order report var purchaseOrderProvider = new PurchaseOrderProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 1) { var purchaseOrderNo = Request.QueryString["transactionNo"].Trim(); dt = purchaseOrderProvider.GetByID(purchaseOrderNo); if (dt != null && dt.Rows.Count > 0) { decimal value = 0.00M; decimal totalValue = 0.00M; foreach (DataRow dr in dt.Rows) { value = Convert.ToDecimal(dr["Value"]); totalValue = totalValue + value; } string textValue = NumberToText(Convert.ToInt32(totalValue), true); System.Data.DataColumn newColumn = new System.Data.DataColumn("TotalAmountInText", typeof(System.String)); newColumn.DefaultValue = textValue; dt.Columns.Add(newColumn); reportDocument.Load(reportPath.PurchaseOrderReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 2) //// Purchase Order Detail Report - Single Product///////////////////// { dt = purchaseOrderProvider.GetAllData(productID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.PurchaseOrderDetailReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region Delivery Challan Report case ReportType.DeliveryChallanReport: //////////// For Delivery Challan Report var deliveryChallanProvider = new DeliveryChallanProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportOption == 2) { var deliveryChallanNo = Request.QueryString["transactionNo"].Trim(); dt = deliveryChallanProvider.GetByID(deliveryChallanNo); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.DeliveryChallanReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { //dt = purchaseOrderProvider.GetAllByDateWise(productID, transactionID, fDate, tDate, adate, reportOption); //if (dt != null && dt.Rows.Count > 0) //{ // if (reportOption == 2) // { // reportDocument.Load(reportPath.RequisitionReportPath); // GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); // } // else if (reportOption == 1) // { // reportDocument.Load(reportPath.RequisitionReportPath); // GetValueAGetDate(dt, reportParameter, reportDocument, adate); // } //} //else //{ // GetMsg(reportParameter, reportDocument, reportPath); //} } break; #endregion #region Production Requisition Report case ReportType.ProductionRequisitionReport: var productionRequisitionProvider = new ProductionRequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportOption == 2) { //var prodReqNo = Request.QueryString["transactionNo"].Trim(); //dt = productionRequisitionProvider.GetByID(prodReqNo); //if (dt != null && dt.Rows.Count > 0) //{ // reportDocument.Load(reportPath.ProductionRequisitionReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} //else //{ // GetMsg(reportParameter, reportDocument, reportPath); //} } else { } break; #endregion #region Prodct Stock Report case ReportType.ProductCurrentStockReport: var productCurrentStockProvider = new ProductCurrentStockProvider { ProductID = Request.QueryString["ProductID"].ToInt(), DivisionID = Request.QueryString["DivisionID"].ToInt(), ProductType = Request.QueryString["ProductType"].ToInt(), FromDate = Request.QueryString["fromDate"].ToString(), Todate = Request.QueryString["todate"].ToString() }; if (productCurrentStockProvider.ProductID == 0) { dt = productCurrentStockProvider.GetDivisionAndItemwise(); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.AllProductStockReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { var mushak16ProviderList = productCurrentStockProvider.GetAll(); if (mushak16ProviderList != null) { reportDocument.Load(reportPath.ProductIndividualStockReportPath); reportDocument.SetDataSource(mushak16ProviderList); GetAddressValue(reportParameter, reportDocument); technoCrystalReport.ReportSource = reportDocument; technoCrystalReport.DataBind(); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region LC Report case ReportType.LCReport: //////////// For LC report var lCProvider = new LCProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 2) /////////////// LC Detail Report /////////////// { dt = lCProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.LCDetailReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 1) //// LC Summary Report ///////////////////// { dt = lCProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.LCSummaryReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region BOE Report case ReportType.BOEReport: //////////// For BOE report var bOEProvider = new BOEProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 2) { dt = bOEProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.BOEDetailReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 1) //// BOE Summary Report ///////////////////// { dt = bOEProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.BOESummaryReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region QA Report case ReportType.QAReport: //////////// For QA report var qAQCRequisitionProvider = new QAQCRequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); Date = GetNullaDatetime(); dt = qAQCRequisitionProvider.GetDateWiseProductInfo(fDate, tDate, Date, productID); if (dt != null && dt.Rows.Count > 0) { { //if (reportOption == 1 && adate == null) //All product summary report //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} //if (reportOption == 1 && adate == null) //All product summary report //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} if (reportOption == 1) { reportDocument.Load(reportPath.QAReportPath); GetValueAGetDate(dt, reportParameter, reportDocument, Date); } else if (reportOption == 2) { reportDocument.Load(reportPath.QAReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } //else if (reportOption == 3) // Purchase ID wise report (showing product details). //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument, printOption); //} } } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion #region Eng. Internal Requisition Report case ReportType.EngineeringInternalRequiReport: //////////// For Eng Requi report var engRequisitionProvider = new EngineeringRequisitionProvider(); var engRequisitionNo = Request.QueryString["transactionNo"].Trim(); dt = engRequisitionProvider.GetByID(engRequisitionNo); if (dt != null && dt.Rows.Count > 0) { { reportDocument.Load(reportPath.EngInternalRequiReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion } }