Beispiel #1
0
 private void BindLabReportSMP()
 {
     try
     {
         LabReportSMPBl objLabReportSMPBl = new LabReportSMPBl();
         var            objResult         = objLabReportSMPBl.LabReportSMP_SelectAll();
         if (objResult != null)
         {
             if (objResult.ResultDt.Rows.Count > 0)
             {
                 gvLabReportSMP.DataSource = objResult.ResultDt;
                 gvLabReportSMP.DataBind();
                 PanelVisibilityMode(true, false);
             }
             else
             {
                 PanelVisibilityMode(false, true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 protected void gvLabReportSMP_OnRowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         LabReportSMPBl objLabReportSMPBL = new LabReportSMPBl();
         if (e.CommandName == "Edit1")
         {
             ViewState["Mode"]           = "Edit";
             ViewState["LabReportSMPID"] = e.CommandArgument.ToString();
             var objResult = objLabReportSMPBL.LabReportSMP_Select(Convert.ToInt32(ViewState["LabReportSMPID"].ToString()));
             if (objResult != null)
             {
                 if (objResult.ResultDt.Rows.Count > 0)
                 {
                     txtDate.Text             = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_DATE].ToString();
                     txtTypeofPowder.Text     = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_TYPEOFPOWDER].ToString();
                     txtTime.Text             = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_TIME].ToString();
                     txtBatchNo.Text          = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_BATCHNO].ToString();
                     txtBagNos.Text           = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_BAGNOS].ToString();
                     txtWeight.Text           = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_WEIGHT].ToString();
                     txtAppearance.Text       = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_APPEARANCE].ToString();
                     txtMoisture.Text         = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_MOISTURE].ToString();
                     txtTotalSolids.Text      = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_TOTALSOLID].ToString();
                     txtBulkDensity.Text      = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_BULKDENSITY].ToString();
                     txtMilkFat.Text          = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_MILKFAT].ToString();
                     txtAcidity.Text          = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_ACIDITY].ToString();
                     txtWettability.Text      = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_WETTABILITY].ToString();
                     txtScorchedparticle.Text = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_SCORCHEDPARTICLE].ToString();
                     txtSolIndex.Text         = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_SOLINDEX].ToString();
                     txtCoffeeTest.Text       = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_COFFETEST].ToString();
                     txtFlavour.Text          = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_FLAVOUR].ToString();
                     txtProtein.Text          = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_PROTEIN].ToString();
                     txtAsh.Text         = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_ASH].ToString();
                     txtLumpiness.Text   = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_LUMPINESS].ToString();
                     txtAdultration.Text = objResult.ResultDt.Rows[0][LabReportSMPBo.LABREPORTSMP_ADULTRATION].ToString();
                     PanelVisibilityMode(false, true);
                 }
             }
         }
         else if (e.CommandName == "Delete1")
         {
             var objResult = objLabReportSMPBL.LabReportSMP_Delete(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session[ApplicationSession.Userid].ToString()), DateTime.UtcNow.AddHours(5.5).ToString());
             if (objResult.Status == ApplicationResult.CommonStatusType.Success)
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Deleted Successfully.');</script>");
                 //  PanelVisibilityMode(true, false);
                 BindLabReportSMP();
             }
             else
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('You can not delete this LabReportSMP because it is in used.');</script>");
             }
         }
     }
     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>");
     }
 }
Beispiel #3
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>");
            }
        }