예제 #1
0
        public int createAudit2(AuditInfo _Audit, string _userI)
        {
            int ret = -1;
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    ret = AuditDataLayer.GetInstance().InsertAudit(connection, _Audit, _userI);
                    if (ret != 1)
                    {
                        foreach (int QuoteID in _Audit.QuoteIDs)
                        {
                            AuditDataLayer.GetInstance().InsertAuditQuote(connection, ret, QuoteID);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ret = -1;
                }
            }
            return(ret);
        }
예제 #2
0
        public ActionMessage insertEmployees(int auditID, List <AuditEmployeeInfo> items)
        {
            ActionMessage        ret           = new ActionMessage();
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    foreach (var item in items)
                    {
                        AuditDataLayer.GetInstance().InsertAuditEmployee(connection, auditID, item);
                    }

                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
예제 #3
0
        public int getTotalRecords(AuditSeachCriteria _criteria, string _userID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                return(AuditDataLayer.GetInstance().getTotalRecords(connection, _criteria, _userID));
            }
        }
예제 #4
0
        public List <string> getListAuditCode(string auditCode)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <string> ListAudit = AuditDataLayer.GetInstance().getListAuditCode(connection, auditCode);
                return(ListAudit);
            }
        }
예제 #5
0
        public SearchAuditInfo GetAuditWordByQuoteID(int _quoteID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                SearchAuditInfo ret = AuditDataLayer.GetInstance().getAuditInfoByQuote(connection, _quoteID);
                return(ret);
            }
        }
예제 #6
0
        public ActionMessage DeleteMuti(string ids, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    if (ids.Length > 0)
                    {
                        //delete Items Table
                        List <AuditEmployeeInfo> currentItems = AuditDataLayer.GetInstance().GetAuditEmployeesByIds(connection, ids);
                        if (currentItems.Count > 0)
                        {
                            string autoIds = "";
                            foreach (var item in currentItems)
                            {
                                autoIds = autoIds + item.AutoID + ',';
                            }
                            autoIds = autoIds.Remove(autoIds.Length - 1);
                            AuditDataLayer.GetInstance().DeleteAuditEmployees(connection, autoIds);
                        }


                        //delete comments
                        CommentSeachCriteria _criteria = new CommentSeachCriteria();
                        _criteria.TableName = TableFile.Audit.ToString();
                        string[] IDsarray = ids.Split(',');
                        foreach (string id in IDsarray)
                        {
                            _criteria.PreferId = id;
                            CommentDataLayer.GetInstance().DeleteComment(connection, _criteria);
                        }

                        //delete attach files and DB of attach files
                        DocumentService.GetInstance().DeleteDocumentsByFeature(TableFile.Audit.ToString(), ids);
                        //delete records
                        List <string> quoteID = AuditDataLayer.GetInstance().GetQuoteByAuditIds(connection, ids);
                        QuoteService.GetInstance().deleteProcess(connection, "Audit", String.Join(", ", quoteID.ToArray()), _userID);
                        AuditDataLayer.GetInstance().DeleteMuti(connection, ids);
                        ret.isSuccess = true;
                    }
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
예제 #7
0
        public List <SearchAuditInfo> getAllAudit(int pageSize, int pageIndex, AuditSeachCriteria _criteria, string _userID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <SearchAuditInfo> ListAudit = AuditDataLayer.GetInstance().getAuditNew(connection, _criteria, _userID);

                return(ListAudit);
            }
        }
예제 #8
0
        public ActionMessage EditEmployees(int auditID, List <AuditEmployeeInfo> _items)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    List <AuditEmployeeInfo> currentItems = AuditDataLayer.GetInstance().GetAuditEmployeesById(connection, auditID.ToString());
                    var listDeleteItem  = new List <AuditEmployeeInfo>();
                    var listInsertItems = new List <AuditEmployeeInfo>();
                    if (_items == null)
                    {
                        listDeleteItem  = currentItems;
                        listInsertItems = new List <AuditEmployeeInfo>();
                    }
                    else
                    {
                        listDeleteItem  = currentItems.Except(_items).ToList();
                        listInsertItems = _items.Except(currentItems).ToList();
                    }
                    //add new Items
                    foreach (var item in listInsertItems)
                    {
                        AuditDataLayer.GetInstance().InsertAuditEmployee(connection, auditID, item);
                    }
                    string autoIds = "";
                    //delete Old Items

                    if (listDeleteItem.Count > 0)
                    {
                        foreach (var item in listDeleteItem)
                        {
                            autoIds = autoIds + item.AutoID + ',';
                        }
                        autoIds = autoIds.Remove(autoIds.Length - 1);
                        AuditDataLayer.GetInstance().DeleteAuditEmployees(connection, autoIds);
                    }

                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
예제 #9
0
        public List <AuditEmployeeInfo> GetAuditDefaultMember()
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    List <AuditEmployeeInfo> currentItems = AuditDataLayer.GetInstance().GetAuditDefaultMember(connection);
                    return(currentItems);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
예제 #10
0
        public List <QuoteAuditInfo> getListQuoteInfos(int auditID)
        {
            List <QuoteAuditInfo> ret           = new List <QuoteAuditInfo>();
            SqlConnectionFactory  sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <int> QuoteIDs = AuditDataLayer.GetInstance().getQuoteOfAudit(connection, auditID);

                foreach (int quoteID in QuoteIDs)
                {
                    QuoteAuditInfo temp = QuoteDataLayer.GetInstance().GetChoosedQuoteDetails(connection, quoteID);
                    temp.ProposalCodes = QuoteDataLayer.GetInstance().GetListProsalCode(connection, quoteID);
                    temp.Items         = QuoteDataLayer.GetInstance().getSelectedItemsQuote(connection, quoteID);
                    ret.Add(temp);
                }
            }
            return(ret);
        }
예제 #11
0
        public ActionMessage editAudit(int id, AuditInfo _Audit, string _userU)
        {
            ActionMessage        ret           = new ActionMessage();
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    AuditDataLayer.GetInstance().UpdateAudit(connection, id, _Audit, _userU);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "123";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
예제 #12
0
        public AuditDetailInfo getAuditInfo(int _ID, string _userID)
        {
            AuditDetailInfo      record        = new AuditDetailInfo();
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                record = AuditDataLayer.GetInstance().getAudtiGeneralInfo(connection, _ID, _userID);
                if (record == null)
                {
                    return(null);
                }
                record.Quotes = getListQuoteInfos(_ID);

                //Get document
                DocumentSeachCriteria documentCriteria = new DocumentSeachCriteria();
                documentCriteria.TableName = TableFile.Audit.ToString();
                documentCriteria.PreferId  = _ID.ToString();
                record.ListDocument        = DocumentService.GetInstance().GetDocument(documentCriteria);

                record.Employees = new List <AuditEmployeeInfo>();
                record.Employees = AuditDataLayer.GetInstance().GetAuditEmployeesById(connection, record.AuditID.ToString());

                //get Comment
                CommentSeachCriteria commentCriteria = new CommentSeachCriteria();
                commentCriteria.TableName = TableFile.Audit.ToString();
                commentCriteria.PreferId  = _ID.ToString();
                record.ListComment        = CommentService.GetInstance().getComment(commentCriteria);
                foreach (var item in record.ListComment)
                {
                    DocumentSeachCriteria documentCriteria2 = new DocumentSeachCriteria();
                    documentCriteria2.TableName = TableFile.Comment.ToString();
                    documentCriteria2.PreferId  = item.AutoID.ToString();
                    item.ListDocument           = DocumentService.GetInstance().GetDocument(documentCriteria2);
                }

                return(record);
            }
        }
예제 #13
0
        public NegotiationPrintModel GetNegotiationPrintModel(int _ID, string _userID)
        {
            NegotiationPrintModel record        = new NegotiationPrintModel();
            NegotiationInfo       info          = new NegotiationInfo();
            SqlConnectionFactory  sqlConnection = new SqlConnectionFactory();

            SearchAuditInfo auditInfo = new SearchAuditInfo();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                info = NegotiationDataLayer.GetInstance().getNegotiation(connection, _ID, _userID);
                if (record == null)
                {
                    return(null);
                }

                CustomerInfo cusInfo = CustomerDataLayer.GetInstance().getCustomer(connection, info.CustomerID);

                auditInfo = AuditDataLayer.GetInstance().getAuditInfoByQuote(connection, info.QuoteID);

                BidPlanPrint bidPlanInfo = BidPlanDataLayer.GetInstance().getBidPlanInfoByQuote(connection, info.QuoteID);


                record.ASide = "BỆNH VIỆN TRUYỀN MÁU HUYẾT HỌC";
                record.BSide = info.CustomerName;

                record.ALocation  = info.Location;
                record.APhone     = info.Phone;
                record.AFax       = info.Fax;
                record.ABankID    = info.BankID;
                record.ATaxCode   = info.TaxCode;
                record.ARepresent = info.Represent;
                record.APosition  = info.Position;

                record.BLocation  = cusInfo.Address;
                record.BPhone     = cusInfo.Phone;
                record.BFax       = cusInfo.Fax;
                record.BBankID    = cusInfo.BankNumber + " " + cusInfo.BankName;
                record.BTaxCode   = cusInfo.TaxCode;
                record.BRepresent = cusInfo.Surrogate;
                record.BPosition  = cusInfo.Position;

                record.DateIn          = info.DateIn;
                record.Term            = info.Term;
                record.NegotiationCode = info.NegotiationCode;
                record.AuditTime       = auditInfo.InTime;
                record.AuditCode       = auditInfo.AuditCode;
                record.VATNumber       = info.VATNumber;
                record.IsVAT           = info.IsVAT;
                record.QuoteTotalCost  = info.QuoteTotalCost;
                record.Items           = QuoteDataLayer.GetInstance().getSelectedItemsQuote(connection,
                                                                                            record.QuoteID);
                record.QuoteID   = info.QuoteID;
                record.QuoteCode = info.QuoteCode;

                record.Items = QuoteDataLayer.GetInstance().getSelectedItemsQuote(connection,
                                                                                  record.QuoteID);


                record.BidExpirated = info.BidExpirated;

                record.BidExpiratedUnit = info.BidExpiratedUnit;

                record.BidType = info.BidType;

                return(record);
            }
        }
예제 #14
0
        public void deleteProcess(SqlConnection connection, string feature, string quoteIds, string _userID)
        {
            switch (feature)
            {
            case "Quote":
                List <string> auditIds = AuditDataLayer.GetInstance().GetAuditByQuoteIds(connection, quoteIds);
                if (auditIds.Count > 0)
                {
                    AuditService.GetInstance().DeleteMuti(String.Join(", ", auditIds.ToArray()), _userID);
                }
                List <string> bidPlans = BidPlanDataLayer.GetInstance().GetBidPlanByQuoteIds(connection, quoteIds);
                if (bidPlans.Count > 0)
                {
                    BidPlanService.GetInstance().DeleteMuti(String.Join(", ", bidPlans.ToArray()), _userID);
                }
                List <string> negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                List <string> decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                List <string> contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                List <string> deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                List <string> acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Audit":
                bidPlans = BidPlanDataLayer.GetInstance().GetBidPlanByQuoteIds(connection, quoteIds);
                if (bidPlans.Count > 0)
                {
                    BidPlanService.GetInstance().DeleteMuti(String.Join(", ", bidPlans.ToArray()), _userID);
                }
                negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "BidPlan":
                negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Negotiation":
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Decision":
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Contract":
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "DeliveryReceipt":
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            default:
                break;
            }
        }