Пример #1
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            try
            {
                LabReportWMPBo objLabReportWMPBo = new LabReportWMPBo();
                //ApplicationResult objResult = new ApplicationResult();
                LabReportWMPBl objLabReportWMPBl = new LabReportWMPBl();
                objLabReportWMPBo.Date             = DateTime.ParseExact(txtDate.Text.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                objLabReportWMPBo.TypeOfPowder     = (txtTypeofPowder.Text.Trim());
                objLabReportWMPBo.Time             = DateTime.ParseExact(txtTime.Text.Trim(), "HH:mm:ss", CultureInfo.InvariantCulture);
                objLabReportWMPBo.BatchNo          = txtBatchNo.Text.Trim();
                objLabReportWMPBo.BagNos           = Convert.ToInt32(txtBatchNo.Text.Trim());
                objLabReportWMPBo.Weight           = float.Parse(txtWeight.Text.Trim());
                objLabReportWMPBo.Appearance       = txtAppearance.Text.Trim();
                objLabReportWMPBo.Moisture         = float.Parse(txtMoisture.Text.Trim());
                objLabReportWMPBo.TotalSolid       = float.Parse(txtTotalSolids.Text.Trim());
                objLabReportWMPBo.BulkDensity      = float.Parse(txtBulkDensity.Text.Trim());
                objLabReportWMPBo.MilkFat          = float.Parse(txtMilkFat.Text.Trim());
                objLabReportWMPBo.Acidity          = txtAcidity.Text.Trim();
                objLabReportWMPBo.Wettability      = txtWettability.Text.Trim();
                objLabReportWMPBo.ScorchedParticle = txtScorchedparticle.Text.Trim();
                objLabReportWMPBo.SolIndex         = txtSolIndex.Text.Trim();
                objLabReportWMPBo.CoffeTest        = txtCoffeeTest.Text.Trim();
                objLabReportWMPBo.Flavour          = txtFlavour.Text.Trim();
                objLabReportWMPBo.Protein          = txtProtein.Text != "" ? float.Parse(txtProtein.Text.Trim(), CultureInfo.InvariantCulture) : 0;
                objLabReportWMPBo.ASH         = txtAsh.Text != "" ? float.Parse(txtAsh.Text.Trim(), CultureInfo.InvariantCulture) : 0;
                objLabReportWMPBo.Lumpiness   = txtLumpiness.Text.Trim();
                objLabReportWMPBo.Adultration = txtAdultration.Text.Trim();
                objLabReportWMPBo.UserId      = Convert.ToInt32(Session[ApplicationSession.Userid]);

                switch (ViewState["Mode"].ToString())
                {
                case "Save":
                    objLabReportWMPBo.CreatedBy   = Convert.ToInt32(Session[ApplicationSession.Userid]);
                    objLabReportWMPBo.CreatedDate = DateTime.UtcNow.AddHours(5.5);
                    break;

                case "Edit":
                    objLabReportWMPBo.LastModifiedBy   = Convert.ToInt32(Session[ApplicationSession.Userid]);
                    objLabReportWMPBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5);
                    break;
                }
                if (ViewState["Mode"].ToString() == "Save")
                {
                    var objResult = objLabReportWMPBl.LabReportWMP_Insert(objLabReportWMPBo);
                    if (objResult.Status == ApplicationResult.CommonStatusType.Success)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</script>");
                        ClearAll();
                        BindLabReportWMP();
                        //PanelVisibilityMode(true, false);
                    }
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    objLabReportWMPBo.Id = Convert.ToInt32(ViewState["LabReportWMPID"].ToString());
                    var objResult = objLabReportWMPBl.LabReportWMP_Update(objLabReportWMPBo);
                    if (objResult.Status == ApplicationResult.CommonStatusType.Success)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Updated Successfully.');</script>");
                        ClearAll();
                        BindLabReportWMP();
                        // PanelVisibilityMode(true, false);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>");
            }
        }
Пример #2
0
        /// <summary>
        /// To Update details of LabReportWMP in LabReportWMP table
        /// Created By : Pavan, 08/07/2017
        /// Modified By :
        /// </summary>
        public ApplicationResult LabReportWMP_Update(LabReportWMPBo objLabReportWMPBO)
        {
            try
            {
                pSqlParameter = new SqlParameter[25];

                pSqlParameter[0]           = new SqlParameter("@Id", SqlDbType.Int);
                pSqlParameter[0].Direction = ParameterDirection.Input;
                pSqlParameter[0].Value     = objLabReportWMPBO.Id;

                pSqlParameter[1]           = new SqlParameter("@TypeOfPowder", SqlDbType.VarChar);
                pSqlParameter[1].Direction = ParameterDirection.Input;
                pSqlParameter[1].Value     = objLabReportWMPBO.TypeOfPowder;

                pSqlParameter[2]           = new SqlParameter("@Time", SqlDbType.DateTime);
                pSqlParameter[2].Direction = ParameterDirection.Input;
                pSqlParameter[2].Value     = objLabReportWMPBO.Time;

                pSqlParameter[3]           = new SqlParameter("@BatchNo", SqlDbType.VarChar);
                pSqlParameter[3].Direction = ParameterDirection.Input;
                pSqlParameter[3].Value     = objLabReportWMPBO.BatchNo;

                pSqlParameter[4]           = new SqlParameter("@BagNo", SqlDbType.Int);
                pSqlParameter[4].Direction = ParameterDirection.Input;
                pSqlParameter[4].Value     = objLabReportWMPBO.BagNos;

                pSqlParameter[5]           = new SqlParameter("@Weight", SqlDbType.Float);
                pSqlParameter[5].Direction = ParameterDirection.Input;
                pSqlParameter[5].Value     = objLabReportWMPBO.Weight;

                pSqlParameter[6]           = new SqlParameter("@Appearance", SqlDbType.VarChar);
                pSqlParameter[6].Direction = ParameterDirection.Input;
                pSqlParameter[6].Value     = objLabReportWMPBO.Appearance;

                pSqlParameter[7]           = new SqlParameter("@Moisture", SqlDbType.Float);
                pSqlParameter[7].Direction = ParameterDirection.Input;
                pSqlParameter[7].Value     = objLabReportWMPBO.Moisture;

                pSqlParameter[8]           = new SqlParameter("@TotalSolid", SqlDbType.Float);
                pSqlParameter[8].Direction = ParameterDirection.Input;
                pSqlParameter[8].Value     = objLabReportWMPBO.TotalSolid;

                pSqlParameter[9]           = new SqlParameter("@BulkDensity", SqlDbType.Float);
                pSqlParameter[9].Direction = ParameterDirection.Input;
                pSqlParameter[9].Value     = objLabReportWMPBO.BulkDensity;

                pSqlParameter[10]           = new SqlParameter("@MilkFat", SqlDbType.Float);
                pSqlParameter[10].Direction = ParameterDirection.Input;
                pSqlParameter[10].Value     = objLabReportWMPBO.MilkFat;

                pSqlParameter[11]           = new SqlParameter("@Acidity", SqlDbType.VarChar);
                pSqlParameter[11].Direction = ParameterDirection.Input;
                pSqlParameter[11].Value     = objLabReportWMPBO.Acidity;

                pSqlParameter[12]           = new SqlParameter("@Wettability", SqlDbType.VarChar);
                pSqlParameter[12].Direction = ParameterDirection.Input;
                pSqlParameter[12].Value     = objLabReportWMPBO.Wettability;

                pSqlParameter[13]           = new SqlParameter("@ScorchedParticle", SqlDbType.VarChar);
                pSqlParameter[13].Direction = ParameterDirection.Input;
                pSqlParameter[13].Value     = objLabReportWMPBO.ScorchedParticle;

                pSqlParameter[14]           = new SqlParameter("@SolIndex", SqlDbType.VarChar);
                pSqlParameter[14].Direction = ParameterDirection.Input;
                pSqlParameter[14].Value     = objLabReportWMPBO.SolIndex;

                pSqlParameter[15]           = new SqlParameter("@CoffeTest", SqlDbType.VarChar);
                pSqlParameter[15].Direction = ParameterDirection.Input;
                pSqlParameter[15].Value     = objLabReportWMPBO.CoffeTest;

                pSqlParameter[16]           = new SqlParameter("@Flavour", SqlDbType.VarChar);
                pSqlParameter[16].Direction = ParameterDirection.Input;
                pSqlParameter[16].Value     = objLabReportWMPBO.Flavour;

                pSqlParameter[17]           = new SqlParameter("@Protein", SqlDbType.Float);
                pSqlParameter[17].Direction = ParameterDirection.Input;
                pSqlParameter[17].Value     = objLabReportWMPBO.Protein;

                pSqlParameter[18]           = new SqlParameter("@ASH", SqlDbType.Float);
                pSqlParameter[18].Direction = ParameterDirection.Input;
                pSqlParameter[18].Value     = objLabReportWMPBO.ASH;

                pSqlParameter[19]           = new SqlParameter("@Lumpiness", SqlDbType.VarChar);
                pSqlParameter[19].Direction = ParameterDirection.Input;
                pSqlParameter[19].Value     = objLabReportWMPBO.Lumpiness;

                pSqlParameter[20]           = new SqlParameter("@Adultration", SqlDbType.VarChar);
                pSqlParameter[20].Direction = ParameterDirection.Input;
                pSqlParameter[20].Value     = objLabReportWMPBO.Adultration;

                pSqlParameter[21]           = new SqlParameter("@UserId", SqlDbType.Int);
                pSqlParameter[21].Direction = ParameterDirection.Input;
                pSqlParameter[21].Value     = objLabReportWMPBO.UserId;

                pSqlParameter[22]           = new SqlParameter("@Date", SqlDbType.DateTime);
                pSqlParameter[22].Direction = ParameterDirection.Input;
                pSqlParameter[22].Value     = objLabReportWMPBO.Date;

                pSqlParameter[23]           = new SqlParameter("@LastModifiedDate", SqlDbType.DateTime);
                pSqlParameter[23].Direction = ParameterDirection.Input;
                pSqlParameter[23].Value     = objLabReportWMPBO.LastModifiedDate;

                pSqlParameter[24]           = new SqlParameter("@LastModifiedBy", SqlDbType.Int);
                pSqlParameter[24].Direction = ParameterDirection.Input;
                pSqlParameter[24].Value     = objLabReportWMPBO.LastModifiedBy;

                sSql = "usp_tbl_LabReportWMP_Update";
                DataTable dtResult = new DataTable();
                dtResult = Database.ExecuteDataTable(CommandType.StoredProcedure, sSql, pSqlParameter);
                ApplicationResult objResults = new ApplicationResult(dtResult);
                objResults.Status = ApplicationResult.CommonStatusType.Success;
                return(objResults);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objLabReportWMPBO = null;
            }
        }