Example #1
0
        public ActionMessage Delete(int id, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    //delete attach files and DB of attach files
                    DocumentService.GetInstance().DeleteDocumentByFeature(TableFile.Negotiation.ToString(), id);


                    //delete commet
                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.Negotiation.ToString();
                    _criteria.PreferId  = id.ToString();
                    CommentDataLayer.GetInstance().DeleteComment(connection, _criteria);

                    //delete record
                    List <string> quoteID = NegotiationDataLayer.GetInstance().GetQuoteByNegotiationIds(connection, id.ToString());
                    QuoteService.GetInstance().deleteProcess(connection, "Negotiation", String.Join(", ", quoteID.ToArray()), _userID);
                    NegotiationDataLayer.GetInstance().Delete(connection, id);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.ToString();
                }
            }
            return(ret);
        }
        public ActionMessage DeleteMuti(string ids, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    //delete employees
                    List <DeliveryReceiptEmployeeInfo> currentItems = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptEmployeesByIds(connection, ids);
                    if (currentItems.Count > 0)
                    {
                        string autoIds = "";
                        foreach (var item in currentItems)
                        {
                            autoIds = autoIds + item.AutoID + ',';
                        }
                        autoIds = autoIds.Remove(autoIds.Length - 1);
                        DeliveryReceiptDataLayer.GetInstance().DeleteDeliveryReceiptEmployees(connection, autoIds);
                    }

                    //delete comments
                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.DeliveryReceipt.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.DeliveryReceipt.ToString(), ids);
                    //delete records

                    /* List<string> acceptanceSids = AcceptanceDataLayer.GetInstance().getAcceptanceByDeliveryReceiptids(connection,ids);
                     * if (acceptanceSids.Count > 0) {
                     *   AcceptanceDataLayer.GetInstance().DeleteMuti(connection,String.Join(", ", acceptanceSids.ToArray()));
                     * }*/
                    List <string> quoteID = DeliveryReceiptDataLayer.GetInstance().GetQuoteByDeliveryReceiptIds(connection, ids);
                    QuoteService.GetInstance().deleteProcess(connection, "DeliveryReceipt", String.Join(", ", quoteID.ToArray()), _userID);
                    DeliveryReceiptDataLayer.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);
        }
Example #3
0
        public TimeLineRecord GetProposalProccess2(int proposalID, string _userI, string _userID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
            TimeLineRecord       ret           = new TimeLineRecord();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                ProcessInfo info = ProposalDataLayer.GetInstance().GetProposalProccessID(connection, proposalID);
                if (info.ProposalID != 0)
                {
                    ret.ProposalDetailInfo = ProposalService.GetInstance().getDetailProposal(info.ProposalID, _userI);
                }
                if (info.SurveyID != 0)
                {
                    ret.SurveyDetailInfo = SurveyService.GetInstance().GetDetailSurvey(info.SurveyID, _userID);
                }
                if (info.ExplanationID != 0)
                {
                    ret.ExplanationDetailInfo = ExplanationService.GetInstance().getDetailExplanation(info.ExplanationID, _userID);
                }
                if (info.QuoteID != 0)
                {
                    ret.QuoteInfo = QuoteService.GetInstance().getQuote(info.QuoteID, _userID);
                }
                if (info.AuditID != 0)
                {
                    ret.AuditDetailInfo = AuditService.GetInstance().getAuditInfo(info.AuditID, _userID);
                }
                if (info.BidPlanID != 0)
                {
                    ret.BidPlanInfo = BidPlanService.GetInstance().getBidPlan(info.BidPlanID, _userID);
                }
                if (info.NegotiationID != 0)
                {
                    ret.NegotiationInfo = NegotiationService.GetInstance().GetNegotiation(info.NegotiationID, _userID);
                }
                if (info.DecisionID != 0)
                {
                    ret.DecisionInfo = DecisionService.GetInstance().GetDecision(info.DecisionID, _userID);
                }
                if (info.ContractID != 0)
                {
                    ret.ContractInfo = ContractService.GetInstance().getContractNew(info.ContractID, _userID);
                }
                if (info.DeliveryReceiptID != 0)
                {
                    ret.DeliveryReceiptInfo = DeliveryReceiptServices.GetInstance().GetDetail(info.DeliveryReceiptID, _userID);
                }
                if (info.AcceptanceID != 0)
                {
                    ret.AcceptanceInfo = AcceptanceServices.GetInstance().GetDetail(info.AcceptanceID, _userID);
                }
            }
            return(ret);
        }
Example #4
0
        public ActionMessage Delete(int id, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    //delete Items Table
                    List <AuditEmployeeInfo> currentItems = AuditDataLayer.GetInstance().GetAuditEmployeesById(connection, id.ToString());
                    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 attach files and DB of attach files
                    DocumentService.GetInstance().DeleteDocumentByFeature(TableFile.Audit.ToString(), id);


                    //delete commet
                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.Audit.ToString();
                    _criteria.PreferId  = id.ToString();
                    CommentDataLayer.GetInstance().DeleteComment(connection, _criteria);

                    //delete Process

                    List <string> quoteID = AuditDataLayer.GetInstance().GetQuoteByAuditIds(connection, id.ToString());
                    QuoteService.GetInstance().deleteProcess(connection, "Audit", String.Join(", ", quoteID.ToArray()), _userID);
                    AuditDataLayer.GetInstance().Delete(connection, id);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.ToString();
                }
            }
            return(ret);
        }
Example #5
0
        public ActionMessage DeleteMuti(string ids, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    //delete comments
                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.Decision.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.Decision.ToString(), ids);
                    //delete records
                    List <string> quoteID = DecisionDataLayer.GetInstance().GetQuoteByDecisionIds(connection, ids);
                    QuoteService.GetInstance().deleteProcess(connection, "Decision", String.Join(", ", quoteID.ToArray()), _userID);
                    DecisionDataLayer.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);
        }