コード例 #1
0
        public static Entity.Common.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.Common.EggPrice EggPrice = new Entity.Common.EggPrice();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        EggPrice.NECCPrice    = (dr[0] == DBNull.Value)? 0 : decimal.Parse(dr[0].ToString());
                        EggPrice.NECCPrice2   = (dr[1] == DBNull.Value) ? 0 : decimal.Parse(dr[1].ToString());
                        EggPrice.NECCPrice3   = (dr[2] == DBNull.Value) ? 0 : decimal.Parse(dr[2].ToString());
                        EggPrice.belowWt      = (dr[3] == DBNull.Value)? 0 : decimal.Parse(dr[3].ToString());
                        EggPrice.overWt       = (dr[4] == DBNull.Value)? 0 : decimal.Parse(dr[4].ToString());
                        EggPrice.belowAddRate = (dr[5] == DBNull.Value)? 0 : decimal.Parse(dr[5].ToString());
                        EggPrice.overAddRate  = (dr[6] == DBNull.Value)? 0 : decimal.Parse(dr[6].ToString());
                    }
                }
                return(EggPrice);
            }
        }
コード例 #2
0
        protected String BStrMssg()
        {
            int    Day             = int.Parse(ddlDay.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" + "Farmer,PTR,Retailer(Whole Bird/Dressed Bird)" + "\n";

            StrMssg.Append(Str1);

            BusinessLayer.Common.BirdPrice ObjBirdPrice = new BusinessLayer.Common.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.Common.EggPrice ObjEggPrice = new BusinessLayer.Common.EggPrice();
                Entity.Common.EggPrice        Eggprice    = new Entity.Common.EggPrice();
                Eggprice = ObjEggPrice.GetAllById(DDate);


                // string Str2 = "Bird weight below " + Eggprice.belowWt.ToString() + "kg.=Dist.rate plus Rs." + Eggprice.belowAddRate.ToString() + ".Bird weight upto(1.1kg-1.3kg)=Dist.rate plus Rs." + Eggprice.overAddRate.ToString() + ".NECC Egg Rate:SB-" + Eggprice.NECCPrice.ToString() + ",NAD-" + Eggprice.NECCPrice2.ToString() + ",NB-" + Eggprice.NECCPrice3.ToString();

                string Str2 = "Bird weight below " + Eggprice.belowWt.ToString() + "kg.=Dist.rate plus Rs." + Eggprice.belowAddRate.ToString() + ".NECC WEST BENGAL Egg Rate of " + DDate.ToString("dd/MM/yyyy") + " Rs. " + Eggprice.NECCPrice.ToString();

                // Bird weight below 1.2kg.= Dist.rate plus Rs.20.00.NECC WEST BENGAL Egg Rate of 09.03.2021 Rs.4.53



                StrMssg.Append(Str2);

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

            return(Mssg);
        }
コード例 #3
0
        public static void Save(Entity.Common.EggPrice EggPrice)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pDate", SqlDbType.DateTime, EggPrice.date);
                oDm.Add("@pNECCPrice", SqlDbType.Decimal, EggPrice.NECCPrice);
                oDm.Add("@pNECCPrice2", SqlDbType.Decimal, EggPrice.NECCPrice2);
                oDm.Add("@pNECCPrice3", SqlDbType.Decimal, EggPrice.NECCPrice3);
                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");
            }
        }
コード例 #4
0
        protected String BStrMssg()
        {
            DateTime DDate = Convert.ToDateTime(BusinessLayer.Common.Common.GetCurrentDate());

            BusinessLayer.Common.EggPrice ObjEggPrice = new BusinessLayer.Common.EggPrice();
            Entity.Common.EggPrice        Eggprice    = new Entity.Common.EggPrice();
            Eggprice = ObjEggPrice.GetAllById(DDate);
            StringBuilder StrMssg = new StringBuilder();
            string        Str1    = "NECC kolkata/WestBengal Egg Rate For." + DDate.ToString("dd/MM/yyyy") + " Rs." + Eggprice.NECCPrice.ToString() + " and for Nadia Rs." + Eggprice.NECCPrice2.ToString() + " and for North Bengal from Malda onwords Rs." + Eggprice.NECCPrice3.ToString() + " and continue till further change culled Bird Rate. Par kg-75";

            StrMssg.Append(Str1);

            if (Mssg == "")
            {
                txtMessageBody.Text = StrMssg.ToString();
            }
            else
            {
                Mssg = txtMessageBody.Text;
            }

            return(Mssg);
        }
コード例 #5
0
        protected void LoadBirdPrice()
        {
            int Day   = int.Parse(ddlDay.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.Common.BirdPrice ObjBirdPrice = new BusinessLayer.Common.BirdPrice();
            DataTable dt = ObjBirdPrice.GetAll(DDate);

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

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

            if (EggPrice != null)
            {
                txtNECCEggRate.Text  = EggPrice.NECCPrice.ToString();
                txtNECCEggRate2.Text = EggPrice.NECCPrice2.ToString();
                txtNECCEggRate3.Text = EggPrice.NECCPrice3.ToString();
                txtbelowWt.Text      = EggPrice.belowWt.ToString();
                txtoverWt.Text       = EggPrice.overWt.ToString();
                txtbelowAddRate.Text = EggPrice.belowAddRate.ToString();
                txtoverAddRate.Text  = EggPrice.overAddRate.ToString();
            }
        }
コード例 #6
0
 public void Save(Entity.Common.EggPrice EggPrice)
 {
     DataAccess.Common.EggPrice.Save(EggPrice);
 }
コード例 #7
0
        protected void SaveBirdRate()
        {
            try
            {
                int Day   = int.Parse(ddlDay.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.Common.BirdPrice ObjBirdPrice = new BusinessLayer.Common.BirdPrice();

                ObjBirdPrice.Save(DDate, DtBirdPrice);


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

                Eggprice.date         = DDate;
                Eggprice.NECCPrice    = decimal.Parse(txtNECCEggRate.Text.Trim());
                Eggprice.NECCPrice2   = decimal.Parse(txtNECCEggRate2.Text.Trim());
                Eggprice.NECCPrice3   = decimal.Parse(txtNECCEggRate3.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);

                Message.IsSuccess = true;
                Message.Text      = "BirdPrice Saved Successfully";
            }
            catch
            {
                Message.IsSuccess = false;
                Message.Text      = "Something went wrong!!! Please try again...";
            }
            finally
            {
                Message.Show = true;
            }
        }