protected void btnAdd_Click(object sender, EventArgs e)
        {
            {
                mcold = new MMilkColdRoomTemperature();
                bcold = new BMilkColdRoomTemperature();
                int Result = 0;
                mcold.MilkColdRoomTemperaturId = 0;
                mcold.RMRId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value);
                mcold.MilkColdRoomTemperaturDate    = Convert.ToDateTime(txtDate.Text.ToString());
                mcold.MilkColdRoomTemperaturShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value);
                //mcold.ColdRoomsForMilk = txtColdRoomsForMilk.Text;
                mcold.ColdRoom1            = txtColdRoom1.Text;
                mcold.ColdRoom2            = txtColdRoom2.Text;
                mcold.ColdRoom3            = txtColdRoom3.Text;
                mcold.CheckedBy            = txtCheckedBy.Text;
                mcold.verifierBy           = txtverifierBy.Text;
                mcold.BreakAndDownServices = txtBreakDownAndServices.Text;
                mcold.MilkColdRoomStatusId = Convert.ToInt32(dpStatusDetailsId.SelectedItem.Value);
                mcold.flag = "Insert";
                Result     = bcold.colddata(mcold);
                if (Result > 0)
                {
                    divDanger.Visible   = false;
                    divwarning.Visible  = false;
                    divSusccess.Visible = true;

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx1').addClass('collapsed-box');", true);

                    //string dates;
                    //dates = string.IsNullOrEmpty(txtSearchDate.Text) ? string.Empty : Convert.ToDateTime(txtSearchDate.Text).ToString("dd-MM-yyyy");
                    //GetMilkColdRoomTemperatureDetails(dates);
                    RMRecieve R = new RMRecieve();
                    R.RMRDate = Convert.ToDateTime(txtSearchDate.Text);
                    GetMilkColdRoomTemperatureDetails(R);
                    uprouteList.Update();
                    lblSuccess.Text = "MilkColdRoomTemperature Data Added Successfully";
                    pnlError.Update();
                }
                else
                {
                    divDanger.Visible   = false;
                    divwarning.Visible  = true;
                    divSusccess.Visible = false;
                    lblSuccess.Text     = "Something went wrong plz contact site admin";
                    pnlError.Update();
                }

                //return Result;
            }
        }
        public void GetMilkColdRoomTemperatureDetails(int RMRId)
        {
            DataSet DS = new DataSet();

            bcold = new BMilkColdRoomTemperature();
            DS    = bcold.GetMilkColdRoomTemperatureDetailsById(RMRId);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkColdRoomTemperaturDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkColdRoomTemperaturDate"].ToString();
                if (DATE == "")
                {
                    txtDate.Text = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else
                {
                    DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat);
                    txtDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd"));
                }
                txtBatchNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BatchNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BatchNo"].ToString();
                dpShiftDetails.ClearSelection();
                string ShiftDetails = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkColdRoomTemperaturShiftId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkColdRoomTemperaturShiftId"].ToString();
                if (ShiftDetails == "")
                {
                    dpShiftDetails.SelectedIndex = 0;
                }
                else
                {
                    dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MilkColdRoomTemperaturShiftId"]).ToString()).Selected = true;
                }

                //txtColdRoomsForMilk.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ColdRoomsForMilk"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ColdRoomsForMilk"].ToString();
                txtColdRoom1.Text            = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ColdRoom1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ColdRoom1"].ToString();
                txtColdRoom2.Text            = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ColdRoom2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ColdRoom2"].ToString();
                txtColdRoom3.Text            = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ColdRoom3"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ColdRoom3"].ToString();
                txtCheckedBy.Text            = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["CheckedBy"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["CheckedBy"].ToString();
                txtverifierBy.Text           = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["verifierBy"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["verifierBy"].ToString();
                txtBreakDownAndServices.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BreakAndDownServices"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BreakAndDownServices"].ToString();
                dpStatusDetailsId.ClearSelection();
                string StatusDetailsId = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkColdRoomStatusId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkColdRoomStatusId"].ToString();
                if (StatusDetailsId == "")
                {
                    dpStatusDetailsId.SelectedIndex = 2;
                }
                else
                {
                    dpStatusDetailsId.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MilkColdRoomStatusId"]).ToString()).Selected = true;
                }
            }
        }
        public void GetMilkColdRoomTemperatureDetails(RMRecieve R)
        {
            bcold = new BMilkColdRoomTemperature();
            DataSet DS = new DataSet();

            DS = bcold.GetMilkColdRoomTemperatureDetails(R);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                rpMilkColdRoomTemperature.DataSource = DS;
                rpMilkColdRoomTemperature.DataBind();
            }
            else if (DS.Tables[0].Rows.Count == 0)
            {
                rpMilkColdRoomTemperature.DataSource = DS;
                rpMilkColdRoomTemperature.DataBind();
            }
        }
        public void GetMilkColdRoomTemperatureDetails(string dates)
        {
            bcold = new BMilkColdRoomTemperature();
            DataSet DS = new DataSet();

            DS = bcold.GetMilkColdRoomTemperatureDetails(dates);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                rpMilkColdRoomTemperature.DataSource = DS;
                rpMilkColdRoomTemperature.DataBind();
            }
            else
            {
                DS.Clear();
                rpMilkColdRoomTemperature.DataSource = DS;
                rpMilkColdRoomTemperature.DataBind();
            }
        }