public DataTable GetProdData() { ProdData prodData = new ProdData(); DataTable dt = prodData.GetRecords(); //DatabaseLauncher.StopWithoutTransaction(); return(dt); }
public void UpdateProduct(ProdDto prodDto, int primaryKeyValue) { prodDto.Creationid = LoginData.UserID; prodDto.CreationDate = DateTime.Now; ProdData prodData = new ProdData(prodDto); prodData.UpdateRecord(primaryKeyValue); LoginData.Stop(); }
public void CreateProduct(ProdDto prodDto) { prodDto.Creationid = LoginData.UserID; prodDto.CreationDate = DateTime.Now; ProdData prodData = new ProdData(prodDto); prodDto.Productid = prodData.CreateRecord(); LoginData.Stop(); }
public List <ProdDto> GetProdDto() { ProdData prodData = new ProdData(); return(prodData.EntityUsers()); }
public ProdDto GetProdDto(int primaryKeyValue) { ProdData prodData = new ProdData(); return(prodData.EntityUser(primaryKeyValue)); }
protected void cmdSave_Click(object sender, EventArgs e) { try { int iPurchaseId = 0; string connection = string.Empty; if (Page.IsValid) { connection = Request.Cookies["Company"].Value; BusinessLogic bll = new BusinessLogic(); string recondate = txtBillDate.Text.Trim(); string salesReturn = string.Empty; string srReason = string.Empty; if (!bll.IsValidDate(connection, Convert.ToDateTime(recondate))) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Date is Invalid.Please contact Administrator.')", true); return; } string sBillno = string.Empty; string sInvoiceno = string.Empty; int iSupplier = 0; int iPaymode = 0; string[] sDate; string[] IDate; string sChequeno = string.Empty; int iBank = 0; int iPurchase = 0; double dTotalAmt = 0; double TQty = 0; double TRate = 0; double TDisc = 0; double TVat = 0; double TCst = 0; //iPurchase = Convert.ToInt32(hdPurchase.Value); sBillno = txtBillno.Text.Trim(); sInvoiceno = txtInvoiveNo.Text.Trim(); DateTime sBilldate; DateTime sInvoicedate; string delim = "/"; char[] delimA = delim.ToCharArray(); CultureInfo culture = new CultureInfo("pt-BR"); salesReturn = "NO"; srReason = string.Empty; iPaymode = Convert.ToInt32(cmdPaymode.SelectedItem.Value); if (iPaymode == 2) { sChequeno = Convert.ToString(txtChequeNo.Text); iBank = Convert.ToInt32(cmbBankName.SelectedItem.Value); rvCheque.Enabled = true; rvbank.Enabled = true; } else { rvbank.Enabled = false; rvCheque.Enabled = false; } Page.Validate("purchaseval"); if (!Page.IsValid) { StringBuilder msg = new StringBuilder(); foreach (IValidator validator in Page.Validators) { if (!validator.IsValid) { msg.Append(" - " + validator.ErrorMessage); msg.Append("\\n"); } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('" + msg.ToString() + "');", true); return; } try { sDate = txtBillDate.Text.Trim().Split(delimA); sBilldate = new DateTime(Convert.ToInt32(sDate[2].ToString()), Convert.ToInt32(sDate[1].ToString()), Convert.ToInt32(sDate[0].ToString())); IDate = txtInvoiveDate.Text.Trim().Split(delimA); sInvoicedate = new DateTime(Convert.ToInt32(IDate[2].ToString()), Convert.ToInt32(IDate[1].ToString()), Convert.ToInt32(IDate[0].ToString())); } catch (Exception ex) { Response.Write("<b><font face='Trebuchet MS' size=2 color=red>Invalid Bill Date Format</font></b>"); return; } iSupplier = Convert.ToInt32(cmbSupplier.SelectedItem.Value); //if (lblTotalSum.Text != string.Empty || lblTotalSum.Text != "0") //dTotalAmt = Convert.ToDouble(lblTotalSum.Text); /*Start Purchase Loading / Unloading Freight Change - March 16*/ double dFreight = 0; double dLU = 0; /*March18*/ if (txtFreight.Text.Trim() != "") { dFreight = Convert.ToDouble(txtFreight.Text.Trim()); } if (txtLU.Text.Trim() != "") { dLU = Convert.ToDouble(txtLU.Text.Trim()); } string usernam = Request.Cookies["LoggedUserName"].Value; TQty = double.Parse(txtQtyAdd.Text); dTotalAmt = double.Parse(GetTotal(double.Parse(txtQtyAdd.Text), double.Parse(txtRateAdd.Text), double.Parse(lblDisAdd.Text), double.Parse(lblVATAdd.Text), 0.0)) + dFreight + dLU; /*End Purchase Loading / Unloading Freight Change - Marcxth 16*/ ProdData ds = new ProdData(); DataRow drNew = ds.Tables["PurchaseProductDs"].NewRow(); drNew["itemCode"] = cmbProdAdd.SelectedValue.ToString(); //drNew["ProductName"] = cmbProdAdd.SelectedItem.Text; drNew["ProductDesc"] = lblProdNameAdd.Text; drNew["PurchaseRate"] = txtRateAdd.Text.Trim(); drNew["NLP"] = txtRateAdd.Text.Trim(); drNew["Qty"] = txtQtyAdd.Text.Trim(); drNew["Measure_Unit"] = String.Empty; drNew["Discount"] = lblDisAdd.Text; drNew["isRole"] = "N"; drNew["VAT"] = lblVATAdd.Text; drNew["CST"] = "0"; drNew["Total"] = GetTotal(Convert.ToDouble(txtQtyAdd.Text.Trim()), Convert.ToDouble(txtRateAdd.Text.Trim()), Convert.ToDouble(lblDisAdd.Text), Convert.ToDouble(lblVATAdd.Text), 0); string narration2 = string.Empty; ds.Tables["PurchaseProductDs"].Rows.Add(drNew); if (ds.Tables["PurchaseProductDs"] != null) { if (ds != null) { /*March 18*/ if (ds.Tables[0].Rows.Count > 0) { /*March 18*/ //string sDataSource = Server.MapPath(ConfigurationSettings.AppSettings["DataSource"].ToString()); BusinessLogic bl = new BusinessLogic(sDataSource); int cntB = bl.isDuplicateBill(sBillno, iSupplier); if (cntB > 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Duplicate Bill Number')", true); return; } /*Start Purchase Loading / Unloading Freight Change - March 16*/ // //iPurchaseId = bl.InsertPurchase(sBillno, sBilldate, iSupplier, iPaymode, sChequeno, iBank, dTotalAmt, salesReturn, srReason, dFreight, dLU, 0, "NO", ds, "NO", sInvoiceno, sInvoicedate, 0, 0, 0, 0, usernam, narration2, 0, "", "", "", null, "", "", "", "", "",false); /*End Purchase Loading / Unloading Freight Change - March 16*/ Reset(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Purchase Details Saved Successfully. Bill No. is " + sBillno.ToString() + "')", true); Session["SalesReturn"] = salesReturn.ToUpper(); ds.Tables["PurchaseProductDs"].Reset(); //Response.Redirect("ProductPurchaseBill.aspx?SID=" + iPurchaseId.ToString() + "&RT=" + salesReturn); /*March 18*/ } /*March 18*/ else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('No products is choosed for the bill')", true); } /*March 18*/ } } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }