Ejemplo n.º 1
0
        void addModuleSelf(string moduleCode, string moduleName, int ID, int parentID, int qty, string manageId, string moduleCodeHD)
        {
            string    typeID = "T0068";
            DataTable dt     = LibQLSX.Select("select TypeId from SourceCode with(nolock) where FolderCode = '" + moduleCode + "'");

            if (dt.Rows.Count > 0)
            {
                typeID = TextUtils.ToString(dt.Rows[0]["TypeId"]);
            }

            ProjectProductsModel projectProduct = new ProjectProductsModel();

            #region Create ProjectModule
            DataTable dtPMID = LibQLSX.Select(" SELECT top 1 ProjectModuleId FROM ProjectModule with(nolock) order by ProjectModuleId desc");
            string    PMid   = TextUtils.ToString(dtPMID.Rows[0]["ProjectModuleId"]);
            PMid = PMid.Substring(2, PMid.Length - 2);
            PMid = "PM" + string.Format("{0:00000000}", TextUtils.ToInt(PMid) + 1);

            ProjectModuleModel projectModule = new ProjectModuleModel();
            projectModule.IsModuleStandard  = 0;
            projectModule.Note              = "";
            projectModule.ProjectModuleCode = moduleCode;
            projectModule.ProjectModuleName = moduleName;
            projectModule.Specifications    = "";

            projectModule.ProjectModuleId = PMid;
            ProjectModuleBO.Instance.InsertQLSX(projectModule);
            #endregion

            #region Update ProjectProducts
            ArrayList listPP = ProjectProductsBO.Instance.FindByAttribute("PProductId", manageId);
            projectProduct = (ProjectProductsModel)listPP[0];
            projectProduct.ProjectModuleId = projectModule.ProjectModuleId;
            projectProduct.TypeId          = typeID;
            ProjectProductsBO.Instance.UpdateQLSX(projectProduct);
            #endregion

            #region Create ChildModule
            DataRow[] drsChild = _dtModule.Select("ParentID = " + ID);
            if (drsChild.Length > 0)
            {
                foreach (DataRow item in drsChild)
                {
                    string moduleCode1 = TextUtils.ToString(item["F5"]);
                    string moduleName1 = TextUtils.ToString(item["F3"]);
                    int    ID1         = TextUtils.ToInt(item["ID"]);
                    int    parentID1   = TextUtils.ToInt(item["ParentID"]);
                    int    qty1        = TextUtils.ToInt(item["F7"]);
                    string manageId1   = projectProduct.PProductId;
                    addModule(moduleCode1, moduleName1, ID1, parentID1, qty1, manageId1, "");
                }
            }
            #endregion
        }
Ejemplo n.º 2
0
        private void chưaYCVTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string pProductId = TextUtils.ToString(treeData.FocusedNode.GetValue(colPProductId));

            if (pProductId == "")
            {
                return;
            }
            ProjectProductsModel m = (ProjectProductsModel)ProjectProductsBO.Instance.FindByAttribute("PProductId", pProductId)[0];

            m.IsYCVT = 0;
            ProjectProductsBO.Instance.UpdateQLSX(m);

            treeData.FocusedNode.SetValue(colIsYCVT, false);
        }
Ejemplo n.º 3
0
        void addModule(string moduleCode, string moduleName, int ID, int parentID, int qty, string manageId, string moduleCodeHD)
        {
            string    typeID = "T0068";
            DataTable dt     = LibQLSX.Select("select TypeId from SourceCode with(nolock) where FolderCode = '" + moduleCode + "'");

            if (dt.Rows.Count > 0)
            {
                typeID = TextUtils.ToString(dt.Rows[0]["TypeId"]);
            }

            ProjectProductsModel projectProduct = new ProjectProductsModel();

            if (parentID == 0)
            {
                if (moduleCode.StartsWith("TPAD"))
                {
                    DataTable dtPP = LibQLSX.Select("select * from vGetProductOfProject with(nolock) where ManageId = '" + manageId + "' and PPCode = '" + moduleCodeHD + "'");
                    foreach (DataRow row in dtPP.Rows)
                    {
                        string id = TextUtils.ToString(row["PProductId"]);

                        #region Create ProjectModule
                        DataTable dtPMID = LibQLSX.Select(" SELECT top 1 ProjectModuleId FROM ProjectModule with(nolock) order by ProjectModuleId desc");
                        string    PMid   = TextUtils.ToString(dtPMID.Rows[0]["ProjectModuleId"]);
                        PMid = PMid.Substring(2, PMid.Length - 2);
                        PMid = "PM" + string.Format("{0:00000000}", TextUtils.ToInt(PMid) + 1);

                        ProjectModuleModel projectModule = new ProjectModuleModel();
                        projectModule.IsModuleStandard  = 0;
                        projectModule.Note              = "";
                        projectModule.ProjectModuleCode = moduleCode;
                        projectModule.ProjectModuleName = moduleName;
                        projectModule.Specifications    = "";

                        projectModule.ProjectModuleId = PMid;
                        ProjectModuleBO.Instance.InsertQLSX(projectModule);
                        #endregion

                        #region Update ProjectProducts
                        ArrayList listPP = ProjectProductsBO.Instance.FindByAttribute("PProductId", id);
                        projectProduct = (ProjectProductsModel)listPP[0];
                        projectProduct.ProjectModuleId = PMid;
                        projectProduct.TypeId          = typeID;
                        ProjectProductsBO.Instance.UpdateQLSX(projectProduct);
                        #endregion

                        #region Create ChildModule
                        DataRow[] drsChild = _dtModule.Select("ParentID = " + ID);
                        if (drsChild.Length > 0)
                        {
                            foreach (DataRow item in drsChild)
                            {
                                string moduleCode1 = TextUtils.ToString(item["F5"]);
                                string moduleName1 = TextUtils.ToString(item["F3"]);
                                int    ID1         = TextUtils.ToInt(item["ID"]);
                                int    parentID1   = TextUtils.ToInt(item["ParentID"]);
                                int    qty1        = TextUtils.ToInt(item["F7"]);
                                string manageId1   = projectProduct.PProductId;
                                addModule(moduleCode1, moduleName1, ID1, parentID1, qty1, manageId1, "");
                            }
                        }
                        #endregion
                    }
                }
                else //Nếu là vật tư phụ
                {
                    #region Create ProjectModule
                    DataTable dtPMID = LibQLSX.Select(" SELECT top 1 ProjectModuleId FROM ProjectModule with(nolock) order by ProjectModuleId desc");
                    string    PMid   = TextUtils.ToString(dtPMID.Rows[0]["ProjectModuleId"]);
                    PMid = PMid.Substring(2, PMid.Length - 2);
                    PMid = "PM" + string.Format("{0:00000000}", TextUtils.ToInt(PMid) + 1);

                    ProjectModuleModel projectModule = new ProjectModuleModel();
                    projectModule.IsModuleStandard  = 0;
                    projectModule.Note              = "";
                    projectModule.ProjectModuleCode = moduleCode;
                    projectModule.ProjectModuleName = moduleName;
                    projectModule.Specifications    = "";

                    projectModule.ProjectModuleId = PMid;
                    ProjectModuleBO.Instance.InsertQLSX(projectModule);
                    #endregion

                    #region Create ProjectProducts
                    DataTable dtPPID = LibQLSX.Select(" SELECT top 1 PProductId FROM ProjectProducts with(nolock) order by PProductId desc");
                    string    PPid   = TextUtils.ToString(dtPPID.Rows[0]["PProductId"]);
                    PPid = PPid.Substring(2, PPid.Length - 2);
                    PPid = "PP" + string.Format("{0:00000000}", TextUtils.ToInt(PPid) + 1);

                    projectProduct.DepartmentCreateId     = "D009";
                    projectProduct.DepartmentDesignId     = "D009";
                    projectProduct.ManageId               = manageId;
                    projectProduct.ManufacturerId         = "M000000001";
                    projectProduct.PProductInforId        = "";
                    projectProduct.ProjectId              = TextUtils.ToString(grvProject.GetFocusedRowCellValue(colProjectID));
                    projectProduct.ProjectModuleId        = projectModule.ProjectModuleId;
                    projectProduct.Status                 = 2;
                    projectProduct.StatusCheckDesignInfor = 1;
                    projectProduct.StatusConfirm          = 1;
                    projectProduct.Total  = qty;
                    projectProduct.TypeId = typeID;
                    projectProduct.Origin = "Việt Nam";

                    projectProduct.PProductId = PPid;
                    ProjectProductsBO.Instance.InsertQLSX(projectProduct);
                    #endregion
                }
            }
            else //nếu là module con
            {
                #region Create ProjectModule
                DataTable dtPMID = LibQLSX.Select(" SELECT top 1 ProjectModuleId FROM ProjectModule with(nolock) order by ProjectModuleId desc");
                string    PMid   = TextUtils.ToString(dtPMID.Rows[0]["ProjectModuleId"]);
                PMid = PMid.Substring(2, PMid.Length - 2);
                PMid = "PM" + string.Format("{0:00000000}", TextUtils.ToInt(PMid) + 1);

                ProjectModuleModel projectModule = new ProjectModuleModel();
                projectModule.IsModuleStandard  = 0;
                projectModule.Note              = "";
                projectModule.ProjectModuleCode = moduleCode;
                projectModule.ProjectModuleName = moduleName;
                projectModule.Specifications    = "";

                projectModule.ProjectModuleId = PMid;
                ProjectModuleBO.Instance.InsertQLSX(projectModule);
                #endregion

                #region Create ProjectProducts
                DataTable dtPPID = LibQLSX.Select(" SELECT top 1 PProductId FROM ProjectProducts with(nolock) order by PProductId desc");
                string    PPid   = TextUtils.ToString(dtPPID.Rows[0]["PProductId"]);
                PPid = PPid.Substring(2, PPid.Length - 2);
                PPid = "PP" + string.Format("{0:00000000}", TextUtils.ToInt(PPid) + 1);

                projectProduct.DepartmentCreateId     = "D009";
                projectProduct.DepartmentDesignId     = "D009";
                projectProduct.ManageId               = manageId;
                projectProduct.ManufacturerId         = "M000000001";
                projectProduct.PProductInforId        = "";
                projectProduct.ProjectId              = TextUtils.ToString(grvProject.GetFocusedRowCellValue(colProjectID));
                projectProduct.ProjectModuleId        = projectModule.ProjectModuleId;
                projectProduct.Status                 = 2;
                projectProduct.StatusCheckDesignInfor = 1;
                projectProduct.StatusConfirm          = 1;
                projectProduct.Total  = qty;
                projectProduct.TypeId = typeID;
                projectProduct.Origin = "Việt Nam";

                projectProduct.PProductId = PPid;
                ProjectProductsBO.Instance.InsertQLSX(projectProduct);
                #endregion

                #region Create ChildModule
                DataRow[] drsChild = _dtModule.Select("ParentID = " + ID);
                if (drsChild.Length > 0)
                {
                    foreach (DataRow item in drsChild)
                    {
                        string moduleCode1 = TextUtils.ToString(item["F5"]);
                        string moduleName1 = TextUtils.ToString(item["F3"]);
                        int    ID1         = TextUtils.ToInt(item["ID"]);
                        int    parentID1   = TextUtils.ToInt(item["ParentID"]);
                        int    qty1        = TextUtils.ToInt(item["F7"]);
                        string manageId1   = projectProduct.PProductId;
                        addModule(moduleCode1, moduleName1, ID1, parentID1, qty1, manageId1, "");
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 4
0
 protected ProjectProductsFacade(ProjectProductsModel model) : base(model)
 {
 }
Ejemplo n.º 5
0
        void addModule(string moduleCode, string moduleName, int ID, int qty, string manageId, decimal price)
        {
            string    typeID = "T0068";
            DataTable dt     = LibQLSX.Select("select TypeId from SourceCode with(nolock) where FolderCode = '" + moduleCode + "'");

            if (dt.Rows.Count > 0)
            {
                typeID = TextUtils.ToString(dt.Rows[0]["TypeId"]);
            }

            ProjectProductsModel projectProduct = new ProjectProductsModel();

            #region Create PProductInfor
            DataTable dtPMID = LibQLSX.Select(" SELECT top 1 PProductInforId FROM PProductInfor with(nolock) order by PProductInforId desc");
            string    PMid   = TextUtils.ToString(dtPMID.Rows[0]["PProductInforId"]);//PPI0000001
            PMid = PMid.Substring(3, PMid.Length - 3);
            PMid = "PPI" + string.Format("{0:0000000}", TextUtils.ToInt(PMid) + 1);

            PProductInforModel ppi = new PProductInforModel();
            ppi.PPCode          = moduleCode.Length >= 50 ? moduleCode.Substring(0, 50) : moduleCode;
            ppi.PPName          = moduleName;
            ppi.Price           = price;
            ppi.PProductInforId = PMid;
            PProductInforBO.Instance.InsertQLSX(ppi);
            #endregion

            #region Create ProjectProducts
            DataTable dtPPID = LibQLSX.Select(" SELECT top 1 PProductId FROM ProjectProducts with(nolock) order by PProductId desc");
            string    PPid   = TextUtils.ToString(dtPPID.Rows[0]["PProductId"]);
            PPid = PPid.Substring(2, PPid.Length - 2);
            PPid = "PP" + string.Format("{0:00000000}", TextUtils.ToInt(PPid) + 1);

            projectProduct.DepartmentCreateId = "D002";
            //projectProduct.DepartmentDesignId = "D009";
            projectProduct.ManageId               = manageId;
            projectProduct.ManufacturerId         = "M000000001";
            projectProduct.ProjectModuleId        = "";
            projectProduct.ProjectId              = TextUtils.ToString(grvProject.GetFocusedRowCellValue(colProjectID));
            projectProduct.PProductInforId        = ppi.PProductInforId;
            projectProduct.Status                 = 1;
            projectProduct.StatusCheckDesignInfor = 1;
            projectProduct.StatusConfirm          = 1;
            projectProduct.Total  = qty;
            projectProduct.TypeId = typeID;
            projectProduct.Origin = "Việt Nam";

            projectProduct.PProductId = PPid;
            ProjectProductsBO.Instance.InsertQLSX(projectProduct);
            #endregion

            #region Create ChildModule
            DataRow[] drsChild = _dtProduct.Select("F2 = '" + ID + "'");
            if (drsChild.Length > 0)
            {
                foreach (DataRow item in drsChild)
                {
                    string moduleName1 = TextUtils.ToString(item["F4"]);
                    string moduleCode1 = TextUtils.ToString(item["F5"]);
                    if (moduleCode1 == "")
                    {
                        moduleCode1 = moduleName1.Length >= 50 ? moduleName1.Substring(0, 50) : moduleName1;
                    }

                    int     ID1       = TextUtils.ToInt(item["F1"]);
                    int     qty1      = TextUtils.ToInt(item["F7"]);
                    decimal price1    = TextUtils.ToDecimal(item["F8"]);
                    string  manageId1 = projectProduct.PProductId;

                    addModule(moduleCode1, moduleName1, ID1, qty1, manageId1, price1);
                }
            }
            #endregion
        }