Exemple #1
0
 public static void UpdateUniSalProjectCode(string SalProjectCode, string ProjectCode)
 {
     try
     {
         if (SalProjectCode != "")
         {
             ProjectStrategyBuilder builder = new ProjectStrategyBuilder();
             builder.AddStrategy(new Strategy(ProjectStrategyName.SalProjectCode, SalProjectCode));
             builder.AddStrategy(new Strategy(ProjectStrategyName.ProjectCodeNot, ProjectCode));
             string     queryString = builder.BuildMainQueryString();
             QueryAgent agent       = new QueryAgent();
             EntityData data        = agent.FillEntityData("Project", queryString);
             agent.Dispose();
             if (data.HasRecord())
             {
                 foreach (DataRow row in data.CurrentTable.Rows)
                 {
                     string text2 = row["ProjectCode"].ToString();
                     agent.ExecuteScalar(string.Format("update project set SalProjectCode = '' where ProjectCode = '{0}'", text2));
                 }
             }
             data.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #2
0
        public static bool IsProjectNameExists(string name, string code)
        {
            bool flag2;

            try
            {
                bool flag = false;
                ProjectStrategyBuilder builder = new ProjectStrategyBuilder();
                builder.AddStrategy(new Strategy(ProjectStrategyName.ProjectName, name));
                builder.AddStrategy(new Strategy(ProjectStrategyName.ProjectCodeNot, code));
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Project", queryString);
                agent.Dispose();
                if (data.HasRecord())
                {
                    flag = true;
                }
                flag2 = flag;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(flag2);
        }
Exemple #3
0
        public static EntityData GetProjectByUnit(string unitCode)
        {
            EntityData data2;

            try
            {
                ProjectStrategyBuilder builder = new ProjectStrategyBuilder();
                builder.AddStrategy(new Strategy(ProjectStrategyName.UnitCode, unitCode));
                QueryAgent agent = new QueryAgent();
                EntityData data  = agent.FillEntityData("Project", builder.BuildMainQueryString());
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #4
0
        protected void btnInput_ServerClick(object sender, System.EventArgs e)
        {
            string inputProjectName = this.txtInputProjectName.Value.Trim();
            string projectCode      = Request["ProjectCode"] + "";

            if (inputProjectName == "")
            {
                Response.Write(Rms.Web.JavaScript.Alert(true, "请输入项目源项目名称 !"));
            }

            try
            {
                // 找到输入的源项目
                ProjectStrategyBuilder sb = new ProjectStrategyBuilder();
                sb.AddStrategy(new Strategy(ProjectStrategyName.ProjectName, inputProjectName));
                string     sql = sb.BuildMainQueryString();
                QueryAgent qa  = new QueryAgent();
                EntityData inputProjectEntity = qa.FillEntityData("Project", sql);
                qa.Dispose();

                string inputProjectCode = "";
                if (inputProjectEntity.HasRecord())
                {
                    inputProjectCode = inputProjectEntity.GetString("ProjectCode");
                }
                inputProjectEntity.Dispose();

                if (inputProjectCode == "")
                {
                    Rms.Web.JavaScript.Alert(true, "没有找到这个项目:" + inputProjectName + ", 请输入完整正确的名称 ! ");
                    return;
                }

                // 删除本项目中的字典项
                EntityData entityItem = DAL.EntityDAO.SystemManageDAO.GetDictionaryItemByProjectCode(projectCode);
                entityItem.DeleteAllTableRow("DictionaryItem");
                DAL.EntityDAO.SystemManageDAO.DeleteDictionaryItem(entityItem);
                entityItem.Dispose();

                EntityData entityName = RmsPM.DAL.EntityDAO.SystemManageDAO.GetDictionaryNameByProjectCode(projectCode);
                entityName.DeleteAllTableRow("DictionaryName");
                DAL.EntityDAO.SystemManageDAO.DeleteDictionaryName(entityName);
                entityName.Dispose();

                // 复制源项目中的内容
                EntityData entityInputName = RmsPM.DAL.EntityDAO.SystemManageDAO.GetDictionaryNameByProjectCode(inputProjectCode);
                EntityData entity          = new EntityData("Standard_DictionaryName");
                int        iCount          = entityInputName.CurrentTable.Rows.Count;

                for (int i = 0; i < iCount; i++)
                {
                    entityInputName.SetCurrentRow(i);
                    string     dictionaryNameCodeInput = entityInputName.GetString("DictionaryNameCode");
                    EntityData entityInput             = DAL.EntityDAO.SystemManageDAO.GetStandard_DictionaryNameByCode(dictionaryNameCodeInput);

                    string dictionaryNameCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("DictionaryNameCode");
                    entity.SetCurrentTable("DictionaryName");
                    DataRow dr = entity.GetNewRecord();
                    dr["Name"]               = entityInput.CurrentRow["Name"];
                    dr["Remark"]             = entityInput.CurrentRow["Remark"];
                    dr["ProjectCode"]        = projectCode;
                    dr["DictionaryNameCode"] = dictionaryNameCode;
                    entity.AddNewRecord(dr);

                    entity.SetCurrentTable("DictionaryItem");
                    entityInput.SetCurrentTable("DictionaryItem");
                    int iICount = entityInput.CurrentTable.Rows.Count;
                    for (int j = 0; j < iICount; j++)
                    {
                        entityInput.SetCurrentRow(j);
                        DataRow drItem = entity.Tables["DictionaryItem"].NewRow();
                        drItem["DictionaryItemCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("DictionaryItemCode");
                        drItem["Name"]               = entityInput.CurrentRow["Name"];
                        drItem["SortID"]             = entityInput.CurrentRow["SortID"];
                        drItem["ProjectCode"]        = projectCode;
                        drItem["DictionaryNameCode"] = dictionaryNameCode;
                        entity.Tables["DictionaryItem"].Rows.Add(drItem);
                    }
                    entityInput.Dispose();
                }
                DAL.EntityDAO.SystemManageDAO.SubmitAllStandard_DictionaryName(entity);
                entity.Dispose();
                entityInputName.Dispose();

                Response.Write(Rms.Web.JavaScript.ScriptStart);
                Response.Write(Rms.Web.JavaScript.Alert(false, "导入成功 !"));
                Response.Write(Rms.Web.JavaScript.PageTo(false, "Dictionary.aspx?ProjectCode=" + projectCode));
                Response.Write(Rms.Web.JavaScript.ScriptEnd);
                Response.End();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "导入出错"));
            }
        }