public static Entity.SMS.EggPrice GetAllById(DateTime Date)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.CommandType = CommandType.StoredProcedure;

                oDm.Add("@pDate", SqlDbType.DateTime, ParameterDirection.Input, Date);

                SqlDataReader       dr       = oDm.ExecuteReader("usp_eggprice_GetegpriceByDate");
                Entity.SMS.EggPrice EggPrice = new Entity.SMS.EggPrice();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        EggPrice.NECCPrice    = (dr[0] == DBNull.Value)? 0 : decimal.Parse(dr[0].ToString());
                        EggPrice.belowWt      = (dr[1] == DBNull.Value)? 0 : decimal.Parse(dr[1].ToString());
                        EggPrice.overWt       = (dr[2] == DBNull.Value)? 0 : decimal.Parse(dr[2].ToString());
                        EggPrice.belowAddRate = (dr[3] == DBNull.Value)? 0 : decimal.Parse(dr[3].ToString());
                        EggPrice.overAddRate  = (dr[4] == DBNull.Value)? 0 : decimal.Parse(dr[4].ToString());
                    }
                }
                return(EggPrice);
            }
        }
Exemple #2
0
        protected void LoadBirdPrice()
        {
            int Day   = int.Parse(ddlDays.SelectedValue.Trim());
            int Month = int.Parse(ddlMonth.SelectedValue.Trim());
            int Year  = int.Parse(ddlYear.SelectedValue.Trim());
            //string SDate = (Month + "/" + Day + "/" + Year).ToString();
            string   SDate = (Year + "-" + Month + "-" + Day).ToString();
            DateTime DDate = Convert.ToDateTime(SDate);

            BusinessLayer.SMS.BirdPrice ObjBirdPrice = new BusinessLayer.SMS.BirdPrice();
            DataTable dt = ObjBirdPrice.GetAll(DDate);

            if (dt != null)
            {
                dgvBirdPrice.DataSource = dt;
                dgvBirdPrice.DataBind();
            }
            else
            {
            }

            BusinessLayer.SMS.EggPrice ObjEggPrice = new BusinessLayer.SMS.EggPrice();
            Entity.SMS.EggPrice        EggPrice    = new Entity.SMS.EggPrice();
            EggPrice = ObjEggPrice.GetAllById(DDate);

            if (EggPrice != null)
            {
                txtNECCEggRate.Text  = EggPrice.NECCPrice.ToString();
                txtbelowWt.Text      = EggPrice.belowWt.ToString();
                txtoverWt.Text       = EggPrice.overWt.ToString();
                txtbelowAddRate.Text = EggPrice.belowAddRate.ToString();
                txtoverAddRate.Text  = EggPrice.overAddRate.ToString();
            }
        }
        public static void Save(Entity.SMS.EggPrice EggPrice)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pDate", SqlDbType.DateTime, EggPrice.date);
                oDm.Add("@pNECCPrice", SqlDbType.Decimal, EggPrice.NECCPrice);
                oDm.Add("@pbelowWt", SqlDbType.Decimal, EggPrice.belowWt);
                oDm.Add("@poverWt", SqlDbType.Decimal, EggPrice.overWt);
                oDm.Add("@pbelowAddRate", SqlDbType.Decimal, EggPrice.belowAddRate);
                oDm.Add("@poverAddRate", SqlDbType.Decimal, EggPrice.overAddRate);



                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_eggprice_SaveAllPrice");
            }
        }
        protected String BStrMssg()
        {
            int    Day             = int.Parse(ddlDays.SelectedValue.Trim());
            int    Month           = int.Parse(ddlMonth.SelectedValue.Trim());
            int    Year            = int.Parse(ddlYear.SelectedValue.Trim());
            string districtDetails = "";
            //string SDate = (Month + "/" + Day + "/" + Year).ToString();
            string   SDate = (Year + "-" + Month + "-" + Day).ToString();
            DateTime DDate = Convert.ToDateTime(SDate);

            StringBuilder StrMssg = new StringBuilder();
            string        Str1    = "WBPF Broiler suggested rate for " + DDate.ToString("dd/MM/yyyy") + "\n";

            StrMssg.Append(Str1);

            BusinessLayer.SMS.BirdPrice ObjBirdPrice = new BusinessLayer.SMS.BirdPrice();
            DataTable dt = ObjBirdPrice.GetAll(DDate);

            if (Mssg == "")
            {
                foreach (DataRow dr in dt.Rows)
                {
                    districtDetails = dr["DistrictName"].ToString() + "-" + dr["FarmRate"].ToString() + "/" + dr["RetailerRate"].ToString() + "/" + dr["BroilerRate"].ToString() + "/" + dr["DressedRate"].ToString() + "\n";
                    StrMssg.Append(districtDetails);
                }
                BusinessLayer.SMS.EggPrice ObjEggPrice = new BusinessLayer.SMS.EggPrice();
                Entity.SMS.EggPrice        Eggprice    = new Entity.SMS.EggPrice();
                Eggprice = ObjEggPrice.GetAllById(DDate);


                //string Str2 = "Bird weight below" + Eggprice.belowWt.ToString() + "kg.=Dist.rate plus Rs." + Eggprice.belowAddRate.ToString() + ".NECC egg rate-" + Eggprice.NECCPrice.ToString();
                string Str2 = "Bird weight below " + Eggprice.belowWt.ToString() + "kg.=Dist.rate plus Rs." + Eggprice.belowAddRate.ToString() + ". NECC egg rate " + Eggprice.NECCPrice.ToString();
                StrMssg.Append(Str2);

                txtMssg.Text = StrMssg.ToString();
            }
            else
            {
                Mssg = txtMssg.Text;
            }

            return(Mssg);
        }
Exemple #5
0
        protected void SaveBirdRate()
        {
            int Day   = int.Parse(ddlDays.SelectedValue.Trim());
            int Month = int.Parse(ddlMonth.SelectedValue.Trim());
            int Year  = int.Parse(ddlYear.SelectedValue.Trim());
            //string SDate = Month + "/" + Day + "/" + Year;
            string SDate = Year + "-" + Month + "-" + Day;

            DateTime DDate = Convert.ToDateTime(SDate);

            DataTable DtBirdPrice = new DataTable();

            DtBirdPrice.Columns.Add("DistrictId", typeof(int));
            DtBirdPrice.Columns.Add("FarmRate", typeof(int));
            DtBirdPrice.Columns.Add("RetailerRate", typeof(int));
            DtBirdPrice.Columns.Add("DressedRate", typeof(int));
            DtBirdPrice.Columns.Add("BroilerRate", typeof(int));
            DtBirdPrice.Columns.Add("Date", typeof(DateTime));

            DataRow dr;
            TextBox Txt;

            foreach (GridViewRow DGR in dgvBirdPrice.Rows)
            {
                dr = DtBirdPrice.NewRow();
                dr["DistrictId"] = int.Parse(dgvBirdPrice.DataKeys[DGR.RowIndex].Value.ToString());

                Txt            = (TextBox)DGR.FindControl("txtFarmRate");
                dr["FarmRate"] = (Txt.Text.Trim().Length == 0) ? 0 : int.Parse(Txt.Text.Trim());

                Txt = (TextBox)DGR.FindControl("txtRetailerRate");
                dr["RetailerRate"] = (Txt.Text.Trim().Length == 0) ? 0 : int.Parse(Txt.Text.Trim());

                Txt = (TextBox)DGR.FindControl("txtDressedRate");
                dr["DressedRate"] = (Txt.Text.Trim().Length == 0) ? 0 : int.Parse(Txt.Text.Trim());

                Txt = (TextBox)DGR.FindControl("txtBroilerRate");
                dr["BroilerRate"] = (Txt.Text.Trim().Length == 0) ? 0 : int.Parse(Txt.Text.Trim());

                dr["Date"] = DDate;

                DtBirdPrice.Rows.Add(dr);
                DtBirdPrice.AcceptChanges();
            }

            BusinessLayer.SMS.BirdPrice ObjBirdPrice = new BusinessLayer.SMS.BirdPrice();

            ObjBirdPrice.Save(DDate, DtBirdPrice);


            BusinessLayer.SMS.EggPrice ObjEggPrice = new BusinessLayer.SMS.EggPrice();
            Entity.SMS.EggPrice        Eggprice    = new Entity.SMS.EggPrice();

            Eggprice.date         = DDate;
            Eggprice.NECCPrice    = decimal.Parse(txtNECCEggRate.Text.Trim());
            Eggprice.belowWt      = decimal.Parse(txtbelowWt.Text.Trim());
            Eggprice.overWt       = decimal.Parse(txtoverWt.Text.Trim());
            Eggprice.belowAddRate = decimal.Parse(txtbelowAddRate.Text.Trim());
            Eggprice.overAddRate  = decimal.Parse(txtoverAddRate.Text.Trim());

            ObjEggPrice.Save(Eggprice);
        }
 public void Save(Entity.SMS.EggPrice EggPrice)
 {
     DataAccess.SMS.EggPrice.Save(EggPrice);
 }