コード例 #1
0
 public void Update(int projectId)
 {
     ProjectManagementService.UpdateProject(new Project
     {
         Id    = projectId,
         Title = Title
     });
 }
コード例 #2
0
        private bool Copy_Stage(int pProjectNo, int pProjectNo_Clone)
        {
            //XmlSerializer serializer = new XmlSerializer(typeof(PM_StageData));
            oCompServ  = (CompanyService)oCompany.GetCompanyService();
            pmgService = (ProjectManagementService)oCompServ.GetBusinessService(ServiceTypes.ProjectManagementService);
            PM_ProjectDocumentParams projectParam = (PM_ProjectDocumentParams)pmgService.GetDataInterface(ProjectManagementServiceDataInterfaces.pmsPM_ProjectDocumentParams);

            projectParam.AbsEntry = pProjectNo;
            PM_ProjectDocumentData project = pmgService.GetProject(projectParam);

            PM_ProjectDocumentParams projectCloneParam = (PM_ProjectDocumentParams)pmgService.GetDataInterface(ProjectManagementServiceDataInterfaces.pmsPM_ProjectDocumentParams);

            projectCloneParam.AbsEntry = pProjectNo_Clone;
            PM_ProjectDocumentData projectclone = pmgService.GetProject(projectCloneParam);

            foreach (PM_StageData sta_tmp in project.PM_StagesCollection)
            {
                PM_StageData tmp = projectclone.PM_StagesCollection.Add();
                tmp.StartDate   = sta_tmp.StartDate;
                tmp.Description = sta_tmp.Description;
                pmgService.UpdateProject(projectclone);
            }
            //Khong con cach nao khac - Can thiep tho bao vao DB voi cac truong UDF cua Stage
            //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
            //string str_comand = "Update A Set";
            //string UDF = ConfigurationManager.AppSettings["UDF_Project_Stage"].ToString();
            //if (!string.IsNullOrEmpty(UDF))
            //{
            //    foreach (string field in UDF.Split(','))
            //    {
            //        str_comand = str_comand + string.Format(" a.{0} = b.{1} ,", field, field);
            //    }
            //    str_comand = str_comand.Substring(0, str_comand.Length - 1);
            //    str_comand += string.Format("From PMG1 as a inner join (Select * from PMG1 where  AbsEntry = {0}) as b on a.LineID = b.LineID where a.AbsEntry = {1}", pProjectNo, pProjectNo_Clone);
            //    SqlCommand cmd = new SqlCommand(str_comand, conn);
            //    try
            //    {
            //        conn.Open();
            //        cmd.ExecuteNonQuery();
            //    }
            //    catch (Exception ex)
            //    {
            //        return false;
            //    }
            //    finally
            //    {
            //        conn.Close();
            //        cmd.Dispose();
            //    }

            //}
            return(true);
        }