예제 #1
0
 public SamplerBLL(SamplerBLL source)
 {
     this._samplingTicketId = source._samplingTicketId;
     this._samplerId        = source._samplerId;
     this._status           = source._status;
     this._createdBy        = source._createdBy;
     this._createdDate      = source._createdDate;
     this._lastModifiedBy   = source._lastModifiedBy;
     this._lastModifiedDate = source._lastModifiedDate;
 }
예제 #2
0
        public List <SamplerBLL> GetSamplerBySamplingId(Guid SamplingId)
        {
            List <SamplerBLL> list = null;
            List <SamplerBLL> Temp;
            SamplerBLL        obj = new SamplerBLL();

            Temp = SamplerDAL.GetSamplerBySamplingId(SamplingId);
            if (Temp != null)
            {
                if (Temp.Count > 0)
                {
                    list = new List <SamplerBLL>();
                    foreach (SamplerBLL i in Temp)
                    {
                        SamplerBLL objSampler = new SamplerBLL();
                        objSampler.SamplerId   = i.SamplerId;
                        objSampler.SamplerName = UserBLL.GetName(i.SamplerId);
                        list.Add(objSampler);
                    }
                }
            }
            return(list);
        }
예제 #3
0
        public Nullable <Guid> InsertSample(SamplingBLL objSampling, SamplerBLL objSampler, bool isMoisture)
        {
            bool issaved = false;

            SqlConnection   conn              = null;
            SqlTransaction  trans             = null;
            int             at                = -1;
            Nullable <Guid> DepositeRequestId = null;

            try
            {
                conn  = Connection.getConnection();
                trans = conn.BeginTransaction();
                //using (TransactionScope scope = new TransactionScope())
                //{
                DepositeRequestId = new Guid(SamplingDAL.InsertSample(objSampling, trans).ToString());
                if (DepositeRequestId == null)
                {
                    trans.Rollback();
                    return(null);
                    //throw new Exception("Invalid Sample Id.");
                }
                objSampling.Id = (Guid)DepositeRequestId;
                AuditTrailBLL objAt = new AuditTrailBLL();
                at = objAt.saveAuditTrail(objSampling, WFStepsName.AddSampleCoding.ToString(), UserBLL.GetCurrentUser(), "Get Sample Ticket");
                if (at == 1)
                {
                    at = -1;
                    objSampler.SampleingTicketId = (Guid)DepositeRequestId;
                    objSampler.Id = Guid.NewGuid();
                    issaved       = SamplerDAL.InsertSampler(objSampler, trans);
                    if (issaved == true)
                    {
                        HttpContext.Current.Session["msg"] = null;
                        WFTransaction.UnlockTask(objSampling.TrackingNo);
                        ECXWF.CMessage mess = WFTransaction.Request(objSampling.TrackingNo);
                        HttpContext.Current.Session["msg"] = mess;
                        if (mess.Name.Trim() == "GetSampleTicket".Trim())
                        {
                            WFTransaction.WorkFlowManager(objSampling.TrackingNo);
                            trans.Commit();
                        }
                        else
                        {
                            objAt.RoleBack();
                            trans.Rollback();
                            DepositeRequestId = null;
                        }
                    }
                    else
                    {
                        objAt.RoleBack();
                        trans.Rollback();
                        DepositeRequestId = null;
                    }
                }
                else
                {
                    trans.Rollback();
                    DepositeRequestId = null;
                    throw new Exception("Unable to log Audit Trail");
                }
                //    scope.Complete();
                // }
            }
            catch (Exception ex)
            {
                trans.Rollback();
                DepositeRequestId = null;
                throw ex;
            }
            finally
            {
                trans.Dispose();
                conn.Close();
            }
            return(DepositeRequestId);
        }