コード例 #1
0
        public void CopyChildEntities(int ParentID)
        {
            string con = ConfigurationHelper.GetsmARTDBContextConnectionString();

            SalesOrderItemLibrary soItemLib = new SalesOrderItemLibrary();

            soItemLib.Initialize(con);
            IEnumerable <SalesOrderItem> soItems = soItemLib.GetAllBySalesOrderID(ParentID, new string[] { "SalesOrder", "Item" });

            Session["SalesOrderItem"] = soItems;

            SalesOrderNotesLibrary soNotesLib = new SalesOrderNotesLibrary();

            soNotesLib.Initialize(con);
            IEnumerable <SalesOrderNotes> soNotess = soNotesLib.GetAllByParentID(ParentID);

            Session["SalesOrderNotes"] = soNotess;

            SalesOrderAttachmentsLibrary soAttachmentsLib = new SalesOrderAttachmentsLibrary();

            soAttachmentsLib.Initialize(con);
            IEnumerable <SalesOrderAttachments> soAttachmentss = soAttachmentsLib.GetAllByParentID(ParentID);

            Session["SalesOrderAttachments"] = soAttachmentss;
        }
コード例 #2
0
        protected override void DeleteChildEntities(string[] childEntityList, string parentID)
        {
            foreach (string ChildEntity in childEntityList)
            {
                switch (ChildEntity)
                {
                    #region /* Case Statements - All child grids */
                case "SalesOrderItem":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderItemLibrary        salesorderItemLibrary = new SalesOrderItemLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderItem> resultList            = (IList <SalesOrderItem>)Session[ChildEntity];
                        foreach (SalesOrderItem item in resultList)
                        {
                            salesorderItemLibrary.Delete(item.ToString());
                        }
                    }
                    break;

                case "SalesOrderNotes":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderNotesLibrary        salesorderNotesLibrary = new SalesOrderNotesLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderNotes> resultList             = (IList <SalesOrderNotes>)Session[ChildEntity];
                        foreach (SalesOrderNotes note in resultList)
                        {
                            salesorderNotesLibrary.Delete(note.ToString());
                        }
                    }
                    break;

                case "SalesOrderAttachments":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderAttachmentsLibrary        salesorderLibrary = new SalesOrderAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderAttachments> resultList        = (IList <SalesOrderAttachments>)Session[ChildEntity];
                        foreach (SalesOrderAttachments attachment in resultList)
                        {
                            salesorderLibrary.Delete(attachment.ToString());
                        }
                    }
                    break;

                    #endregion
                }
            }
        }
コード例 #3
0
        protected override void SaveChildEntities(string[] childEntityList, SalesOrder entity)
        {
            foreach (string ChildEntity in childEntityList)
            {
                switch (ChildEntity)
                {
                    #region /* Case Statements - All child grids */
                case "SalesOrderItem":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderItemLibrary        salesorderItemLibrary = new SalesOrderItemLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderItem> resultList            = (IList <SalesOrderItem>)Session[ChildEntity];
                        foreach (SalesOrderItem salesorderItem in resultList)
                        {
                            salesorderItem.SalesOrder = new SalesOrder {
                                ID = entity.ID
                            };
                            //itemNote.Notes = System.Web.HttpUtility.HtmlDecode(itemNote.Notes);
                            salesorderItemLibrary.Add(salesorderItem);
                        }
                    }
                    break;

                case "SalesOrderNotes":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderNotesLibrary        salesorderNotesLibrary = new SalesOrderNotesLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderNotes> resultList             = (IList <SalesOrderNotes>)Session[ChildEntity];
                        foreach (SalesOrderNotes salesorderNote in resultList)
                        {
                            salesorderNote.Parent = new SalesOrder {
                                ID = entity.ID
                            };
                            //itemNote.Notes = System.Web.HttpUtility.HtmlDecode(itemNote.Notes);
                            salesorderNotesLibrary.Add(salesorderNote);
                        }
                    }
                    break;

                case "SalesOrderAttachments":
                    if (Session[ChildEntity] != null)
                    {
                        SalesOrderAttachmentsLibrary        salesorderLibrary = new SalesOrderAttachmentsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <SalesOrderAttachments> resultList        = (IList <SalesOrderAttachments>)Session[ChildEntity];
                        string      destinationPath;
                        string      sourcePath;
                        FilelHelper fileHelper = new FilelHelper();
                        foreach (SalesOrderAttachments salesorder in resultList)
                        {
                            destinationPath          = fileHelper.GetSourceDirByFileRefId(salesorder.Document_RefId.ToString());     // Path.Combine(Configuration.GetsmARTDocPath(), SalesOrder.Document_RefId.ToString());
                            sourcePath               = fileHelper.GetTempSourceDirByFileRefId(salesorder.Document_RefId.ToString()); // Path.Combine(Configuration.GetsmARTTempDocPath(), SalesOrder.Document_RefId.ToString());
                            salesorder.Document_Path = fileHelper.GetFilePath(sourcePath);
                            fileHelper.MoveFile(salesorder.Document_Name, sourcePath, destinationPath);

                            salesorder.Parent = new SalesOrder {
                                ID = entity.ID
                            };
                            salesorderLibrary.Add(salesorder);
                        }
                    }
                    break;

                    #endregion
                }
            }
        }