public ActionMessage Delete(int id)
        {
            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.Acceptance.ToString(), id);

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

                    //delete record
                    AcceptanceDataLayer.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);
        }
Exemple #2
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);
        }
Exemple #3
0
        public int InsertComment(CommentInfo commentInfo, string _userI)
        {
            int ret = -1;

            if (!(string.IsNullOrEmpty(commentInfo.TableName)))
            {
                SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
                using (SqlConnection connection = sqlConnection.GetConnection())
                {
                    try
                    {
                        ret = CommentDataLayer.GetInstance().insertComment(connection, commentInfo, _userI);
                    }
                    catch (Exception ex)
                    {
                        ret = -1;
                    }
                }
                return(ret);
            }
            else
            {
                return(-1);
            }
        }
Exemple #4
0
        public ActionMessage DeleteAll(string ids)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    //delete comments
                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.Explanation.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.Explanation.ToString(), ids);
                    //delete records
                    ExplanationDataLayer.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);
        }
        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);
        }
Exemple #6
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);
        }
Exemple #7
0
 public List <CommentInfo> getComment(CommentSeachCriteria _criteria)
 {
     if (!string.IsNullOrEmpty(_criteria.TableName) && !string.IsNullOrEmpty(_criteria.PreferId))
     {
         SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
         using (SqlConnection connection = sqlConnection.GetConnection())
         {
             List <CommentInfo> ListComment = CommentDataLayer.GetInstance().getComment(connection, _criteria);
             return(ListComment);
         }
     }
     else
     {
         return(null);
     }
 }
Exemple #8
0
        public ActionMessage deleteComments(string ids)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    CommentDataLayer.GetInstance().DeleteComments(connection, ids);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
Exemple #9
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);
        }
Exemple #10
0
        public ActionMessage DeleteProposals(string ids, string user, string _userID)
        {
            ActionMessage ret  = new ActionMessage();
            UserLogInfo   info = new UserLogInfo();

            info.Action      = "Delete ";
            info.Description = " ids: " + ids;
            info.Feature     = TableFile.Proposal.ToString();
            info.Time        = DateTime.Now;
            info.UserName    = user;
            info.UserID      = 1;
            UserService.GetInstance().TrackUserAction(info);
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

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

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

                    /*  //deleteRelatedProsal
                     * var quoteIds = QuoteDataLayer.GetInstance().GetQuotesByProposalId(connection, ids);
                     *
                     * QuoteService.DeleteMuti(String.Join(", ", quoteIds.ToArray()));*/

                    var surveyIds = SurveyDataLayer.GetInstance().GetSurveyByProposalId(connection, ids);

                    if (surveyIds != null && surveyIds.Count > 0)
                    {
                        SurveyDataLayer.GetInstance().DeleteMuti(connection, String.Join(", ", surveyIds.ToArray()));
                    }

                    var explanationServiceIds = ExplanationDataLayer.GetInstance().GetExplanationsByProposalId(connection, ids, _userID);
                    if (explanationServiceIds != null && explanationServiceIds.Count > 0)
                    {
                        ExplanationDataLayer.GetInstance().DeleteMuti(connection, String.Join(", ", explanationServiceIds.ToArray()));
                    }


                    ProposalDataLayer.GetInstance().DeleteProposals(connection, ids);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
Exemple #11
0
        public ActionMessage DeleteProposal(int id, string user, string _userID)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    ProposalDetailInfo temp = ProposalService.GetInstance().getDetailProposal(id, "");

                    UserLogInfo info = new UserLogInfo();
                    info.Action = "Delete ";

                    if (temp != null)
                    {
                        info.Description = "code : " + temp.ProposalCode + " id : " + id;
                    }
                    else
                    {
                        info.Description = " id : " + id;
                    }
                    info.Feature  = TableFile.Proposal.ToString();
                    info.Time     = DateTime.Now;
                    info.UserName = user;
                    info.UserID   = 1;
                    UserService.GetInstance().TrackUserAction(info);

                    //delete Items Table
                    List <ItemPropsalInfo> currentItems = ProposalDataLayer.GetInstance().GetPropsalItems(connection, id);
                    if (currentItems.Count > 0)
                    {
                        string autoIds = "";
                        foreach (var item in currentItems)
                        {
                            autoIds = autoIds + item.AutoID + ',';
                        }
                        autoIds = autoIds.Remove(autoIds.Length - 1);
                        ProposalDataLayer.GetInstance().DeleteProposalItems(connection, autoIds);
                    }


                    CommentSeachCriteria _criteria = new CommentSeachCriteria();
                    _criteria.TableName = TableFile.Proposal.ToString();
                    _criteria.PreferId  = id.ToString();
                    CommentDataLayer.GetInstance().DeleteComment(connection, _criteria);

                    //delete attach files and DB of attach files
                    DocumentService.GetInstance().DeleteDocumentByFeature(TableFile.Proposal.ToString(), id);

                    //deleteRelatedProsal
                    //             ..   var quoteIds = QuoteDataLayer.GetInstance().GetQuotesByProposalId(connection,id.ToString());
                    // if(quoteIds.Count > 0)
                    //                  QuoteService.DeleteMuti(String.Join(", ", quoteIds.ToArray()));


                    var surveyIds = SurveyDataLayer.GetInstance().GetSurveyByProposalId(connection, id.ToString());


                    if (surveyIds.Count > 0)
                    {
                        SurveyDataLayer.GetInstance().DeleteMuti(connection, String.Join(", ", surveyIds.ToArray()));
                    }

                    var explanationServiceIds = ExplanationDataLayer.GetInstance().GetExplanationsByProposalId(connection, id.ToString(), _userID);

                    if (explanationServiceIds.Count > 0)
                    {
                        ExplanationDataLayer.GetInstance().DeleteMuti(connection, String.Join(", ", explanationServiceIds.ToArray()));
                    }


                    //delete record
                    ProposalDataLayer.GetInstance().DeleteProposal(connection, id);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.ToString();
                }
            }
            return(ret);
        }