Esempio n. 1
0
        public BatchActivity Get(string BatchID, long ActID)
        {
            BatchActivity   objBatchActivity   = new BatchActivity();
            Batch_DL        objBatch_DL        = new Batch_DL(Connection);
            Employee_DL     objEmployee_DL     = new Employee_DL(Connection);
            MainActivity_DL objMainActivity_DL = new MainActivity_DL(Connection);


            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@ActID", ActID),
                    new SqlParameter("@BatchID", BatchID)
                };

                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_BatchActivity_By_Batch_Act", paramList);

                if (dt.Rows.Count != 0)
                {
                    objBatchActivity.MainActivity = objMainActivity_DL.Get(Convert.ToInt64(dt.Rows[0]["ActID"]));
                    objBatchActivity.BatchActID   = Convert.ToInt64(dt.Rows[0]["BatchActID"]);
                    objBatchActivity.Batch        = objBatch_DL.Get(dt.Rows[0]["BatchID"].ToString());

                    objBatchActivity.BatchActStatus = (BatchActivity.Status)dt.Rows[0]["BatchActStatus"];

                    if (dt.Rows[0]["SequenceNo"] != DBNull.Value)
                    {
                        objBatchActivity.SequenceNo = Convert.ToInt32(dt.Rows[0]["SequenceNo"]);
                    }
                    objBatchActivity.Part = dt.Rows[0]["Part"].ToString();

                    objBatchActivity.LastEdited        = Convert.ToDateTime(dt.Rows[0]["LastEdited"]);
                    objBatchActivity.BlockNextActivity = Convert.ToBoolean(dt.Rows[0]["BlockNextActivity"]);
                    objBatchActivity.ActMethod         = Convert.ToString(dt.Rows[0]["ActMethod"]);

                    if (dt.Rows[0]["StartQty"] != DBNull.Value)
                    {
                        objBatchActivity.StartQty = Convert.ToDecimal(dt.Rows[0]["StartQty"]);
                    }

                    if (dt.Rows[0]["StopQty"] != DBNull.Value)
                    {
                        objBatchActivity.StopQty = Convert.ToDecimal(dt.Rows[0]["StopQty"]);
                    }
                    if (dt.Rows[0]["SupervisedBy"] != DBNull.Value)
                    {
                        objBatchActivity.SupervisedBy = objEmployee_DL.Get(dt.Rows[0]["SupervisedBy"].ToString());
                    }
                }

                return(objBatchActivity);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Esempio n. 2
0
        public Batch Get(String BatchID)
        {
            Batch       objBatch      = new Batch();
            Employee_DL objEmplyeeDL  = new Employee_DL(Connection);
            Batch_DL    objBatchDL    = new Batch_DL(Connection);
            STDBatch_DL objSTDBatchDL = new STDBatch_DL(Connection);


            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@BatchID", BatchID)
                };

                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_Batch_By_ID", paramList);


                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["BatchApprovedBy"].ToString() != "N/A")
                    {
                        objBatch.BatchApprovedBy = objEmplyeeDL.Get(Convert.ToString(dt.Rows[0]["BatchApprovedBy"]));
                    }
                    if (dt.Rows[0]["BatchApprovedDate"] != null)
                    {
                        objBatch.BatchApprovedDate = Convert.ToDateTime(dt.Rows[0]["BatchApprovedDate"]);
                    }

                    objBatch.BatchDivideCount = Convert.ToInt32(dt.Rows[0]["BatchDivideCount"]);

                    if (dt.Rows[0]["BatchEndDate"] != null)
                    {
                        objBatch.BatchEndDate = Convert.ToDateTime(dt.Rows[0]["BatchEndDate"]);
                    }

                    if (dt.Rows[0]["BatchGeneratedBy"].ToString() != "N/A")
                    {
                        objBatch.BatchGenerateBy = objEmplyeeDL.Get(Convert.ToString(dt.Rows[0]["BatchGeneratedBy"]));
                    }

                    objBatch.BatchGenerateDate = Convert.ToDateTime(dt.Rows[0]["BatchGeneratedDate"]);
                    objBatch.BatchID           = Convert.ToString(dt.Rows[0]["BatchID"]);

                    if (dt.Rows[0]["BatchStartDate"] != null)
                    {
                        objBatch.BatchStartDate = Convert.ToDateTime(dt.Rows[0]["BatchStartDate"]);
                    }

                    objBatch.BatchStatus = (Batch.Status)dt.Rows[0]["BatchStatus"];

                    if (dt.Rows[0]["BatchSuperviser"].ToString() != "N/A")
                    {
                        objBatch.BatchSuperviser = objEmplyeeDL.Get(Convert.ToString(dt.Rows[0]["BatchSuperviser"]));
                    }

                    objBatch.BatchType = Convert.ToString(dt.Rows[0]["BatchType"]);

                    if (dt.Rows[0]["BatchFinalQty"] != DBNull.Value)
                    {
                        objBatch.BatchFinalQty = Convert.ToDecimal(dt.Rows[0]["BatchFinalQty"]);
                    }

                    objBatch.BatchSize = Convert.ToDecimal(dt.Rows[0]["BatchSize"]);

                    if (dt.Rows[0]["FinalizedBy"].ToString() != "")
                    {
                        objBatch.FinalizedBy = objEmplyeeDL.Get(Convert.ToString(dt.Rows[0]["FinalizedBy"]));
                    }

                    if (dt.Rows[0]["FinalizedDate"] != DBNull.Value)
                    {
                        objBatch.FinalizedDate = Convert.ToDateTime(dt.Rows[0]["FinalizedDate"]);
                    }

                    objBatch.StandardBatch = objSTDBatchDL.Get(Convert.ToString(dt.Rows[0]["BatchSTDBatchID"]));
                }

                return(objBatch);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }