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

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

                case "Edit":
                    objLabReportSMPBo.LastModifiedBy   = Convert.ToInt32(Session[ApplicationSession.Userid]);
                    objLabReportSMPBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5);
                    break;
                }
                if (ViewState["Mode"].ToString() == "Save")
                {
                    var objResult = objLabReportSMPBl.LabReportSMP_Insert(objLabReportSMPBo);
                    if (objResult.Status == ApplicationResult.CommonStatusType.Success)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</script>");
                        ClearAll();
                        BindLabReportSMP();
                        //PanelVisibilityMode(true, false);
                    }
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    objLabReportSMPBo.Id = Convert.ToInt32(ViewState["LabReportSMPID"].ToString());
                    var objResult = objLabReportSMPBl.LabReportSMP_Update(objLabReportSMPBo);
                    if (objResult.Status == ApplicationResult.CommonStatusType.Success)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Updated Successfully.');</script>");
                        ClearAll();
                        BindLabReportSMP();
                        // 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>");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// To Update details of LabReportSMP in LabReportSMP table
        /// Created By : Pavan, 08/07/2017
        /// Modified By :
        /// </summary>
        public ApplicationResult LabReportSMP_Update(LabReportSMPBo objLabReportSMPBO)
        {
            try
            {
                pSqlParameter = new SqlParameter[25];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                sSql = "usp_tbl_LabReportSMP_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
            {
                objLabReportSMPBO = null;
            }
        }