private void AlertForItemPrice() { String ItemName = null; // DateTime CurrentDate; CPriceMasterBO oPriceMasterBO = new CPriceMasterBO(); CResult oResultPriceMaster = new CResult(); CPriceMaster oPriceMaster = new CPriceMaster(); oResultPriceMaster = oPriceMasterBO.ReadAllForAlert(); if (oResultPriceMaster.IsSuccess) { DataTable dt = oResultPriceMaster.Data as DataTable; foreach (DataRow dr in dt.Rows) { oPriceMaster.Price_ToDate = DateTime.Parse(dr["Price_ToDate"].ToString()); //ToString("dd-MM-yy"); oPriceMaster.Price_ItemOId = dr["Price_ItemOId"].ToString(); oPriceMaster.Price_ItemName = dr["ItemName"].ToString(); // if (oPriceMaster.Price_ToDate < CurrentDate) ItemName = ItemName + oPriceMaster.Price_ItemName.ToString() + "\n"; } } if (ItemName != null) { frmPopup ofrmPopUp = new frmPopup(PopupSkins.AlertSkin); ofrmPopUp.ShowPopup("Price Update!!", "Price Should Be Updated Following Items-" + ItemName + "", 500, 10000, 500); } }
private CPriceMaster Getformdata() { CPriceMaster oPM = new CPriceMaster(); oPM.Price_OId = txtOId.Text; oPM.Price_Branch = currentBranch.CompBrn_Code; oPM.Price_ItemOId = ddl_ItemName.SelectedValue.ToString(); oPM.Price_FromDate = dtp_From.Value; oPM.Price_ToDate = dtp_To.Value; oPM.Price_Currency = ddlCurrency.SelectedValue.ToString(); oPM.Price_FactoryPrice = float.Parse(txt_FactoryPrice.Text.Trim()); oPM.Price_ListPrice = float.Parse(txt_ListPrice.Text.Trim()); oPM.Price_VatPercent = float.Parse(txt_VATPercent.Text.Trim()); oPM.Price_VatPrice = float.Parse(txt_VATPrice.Text.Trim()); oPM.Price_Disc = float.Parse(txtDiscPer.Text.Trim()); oPM.Price_DiscPrice = float.Parse(txtDiscPrice.Text.Trim()); oPM.Creator = currentUser.User_OID; oPM.CreationDate = DateTime.Now.Date; oPM.UpdateBy = currentUser.User_OID; oPM.UpdateDate = DateTime.Now.Date; return(oPM); }
private void LoadPriceMasterData() { lvPriceList.Items.Clear(); CPriceMasterBO oPriceMasterBO = new CPriceMasterBO(); CResult oResult = new CResult(); CPriceMaster oPriceMaster = new CPriceMaster(); oResult = oPriceMasterBO.ReadAll(ddl_ItemName.SelectedValue.ToString()); if (oResult.IsSuccess) { DataTable dt = oResult.Data as DataTable; foreach (DataRow dr in dt.Rows) { ListViewItem oItem = new ListViewItem(); oItem.Text = dr["ItemName"].ToString(); oItem.SubItems.Add(DateTime.Parse(dr["Price_FromDate"].ToString()).Date.ToString("dd-MM-yy")); oItem.SubItems.Add(DateTime.Parse(dr["Price_ToDate"].ToString()).Date.ToString("dd-MM-yy")); oItem.SubItems.Add(dr["Price_FactoryPrice"].ToString()); oItem.SubItems.Add(dr["Price_ListPrice"].ToString()); oItem.SubItems.Add(dr["Price_VatPercent"].ToString()); oItem.SubItems.Add(dr["Price_VatPrice"].ToString()); oItem.SubItems.Add(dr["Price_Disc"].ToString()); oItem.SubItems.Add(dr["Price_DiscPrice"].ToString()); oItem.SubItems.Add(dr["Currency_Code"].ToString()); lvPriceList.Items.Add(oItem); } } else { MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private CPriceMaster GetResultSetToPM(DataRow dr) { CPriceMaster oPM = new CPriceMaster(); oPM.Price_OId = dr["Price_OId"].ToString(); oPM.Price_Branch = dr["Price_Branch"].ToString(); oPM.Price_ItemOId = dr["Price_ItemOId"].ToString(); oPM.Price_FromDate = DateTime.Parse(dr["Price_FromDate"].ToString()); oPM.Price_ToDate = DateTime.Parse(dr["Price_ToDate"].ToString()); oPM.Price_Currency = dr["Price_Currency"].ToString(); oPM.Price_FactoryPrice = float.Parse(dr["Price_FactoryPrice"].ToString()); oPM.Price_ListPrice = float.Parse(dr["Price_ListPrice"].ToString()); oPM.Price_VatPercent = float.Parse(dr["Price_VatPercent"].ToString()); oPM.Price_VatPrice = float.Parse(dr["Price_VatPrice"].ToString()); oPM.Price_Disc = float.Parse(dr["Price_Disc"].ToString()); oPM.Price_DiscPrice = float.Parse(dr["Price_DiscPrice"].ToString()); oPM.Creator = dr["Price_Creator"].ToString(); oPM.CreationDate = DateTime.Parse(dr["Price_CreationDate"].ToString()); oPM.UpdateBy = dr["Price_UpdateBy"].ToString(); oPM.UpdateDate = DateTime.Parse(dr["Price_UpdateDate"].ToString()); return(oPM); }
public CResult Create(CPriceMaster oPM) { oResult = new CResult(); conn = oConnManager.GetConnection(out s_DBError); if (conn != null) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.Transaction = oConnManager.BeginTransaction(); try { cmd.CommandText = "sp_Price_Insert"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); // cmd.Parameters.AddWithValue("@Price_OId", oPM.Price_OId); cmd.Parameters.AddWithValue("@Price_Branch", oPM.Price_Branch); cmd.Parameters.AddWithValue("@Price_ItemOId", oPM.Price_ItemOId); cmd.Parameters.AddWithValue("@Price_FromDate", oPM.Price_FromDate); cmd.Parameters.AddWithValue("@Price_ToDate", oPM.Price_ToDate); cmd.Parameters.AddWithValue("@Price_Currency", oPM.Price_Currency); cmd.Parameters.AddWithValue("@Price_FactoryPrice", oPM.Price_FactoryPrice); cmd.Parameters.AddWithValue("@Price_ListPrice", oPM.Price_ListPrice); cmd.Parameters.AddWithValue("@Price_VatPercent", oPM.Price_VatPercent); cmd.Parameters.AddWithValue("@Price_VatPrice", oPM.Price_VatPrice); cmd.Parameters.AddWithValue("@Price_Disc", oPM.Price_Disc); cmd.Parameters.AddWithValue("@Price_DiscPrice", oPM.Price_DiscPrice); cmd.Parameters.AddWithValue("@Price_Creator", oPM.Creator); cmd.Parameters.AddWithValue("@Price_CreationDate", oPM.CreationDate); cmd.Parameters.AddWithValue("@Price_UpdateBy", oPM.UpdateBy); cmd.Parameters.AddWithValue("@Price_UpdateDate", oPM.UpdateDate); cmd.ExecuteNonQuery(); oConnManager.Commit(); oResult.IsSuccess = true; } catch (SqlException e) { string sRollbackError = oConnManager.Rollback(); oResult.IsSuccess = false; oResult.ErrMsg = sRollbackError.Equals("") ? oConnManager.GetErrorMessage(e) : sRollbackError; } finally { oConnManager.Close(); } } else { oResult.IsSuccess = false; oResult.ErrMsg = s_DBError; } return(oResult); }
private void btnSave_Click(object sender, EventArgs e) { CPriceMasterBO oPMBO = new CPriceMasterBO(); CPriceMaster oPM = new CPriceMaster(); CResult oResult = new CResult(); if (validatedata()) { oResult = oPMBO.Create(Getformdata()); if (oResult.IsSuccess) { MessageBox.Show("saved succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadPriceMasterData(); clearformdata(); } else { MessageBox.Show("can not be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }