public static bool IsLegalFormat(bool printFlag, LineObject lineObject, string filler, int beginIndex, bool isTab, bool checkLength) { bool flag = true; if (filler.Length <= 0) { if (checkLength == true) { ErrMsg.PrintErrMsg(printFlag, 1, lineObject, filler, beginIndex, beginIndex, isTab); flag = false; } } else if ((filler[0] == '=') || (filler[0] == ' ') || (filler[0] == '|')) { ErrMsg.PrintErrMsg(printFlag, 2, lineObject, filler, beginIndex + 1, beginIndex + 1, isTab); flag = false; } return(flag); }
private static bool CheckZeroOneWholeLine(LineObject lineObject, bool printFlag, CheckSt st, LexRecord lexObj, CheckObject checkObject, UpdateLex updateLex) { bool flag = checkObject.IsNextStartStr(lineObject.GetLine()); if (flag == true) { st.UpdateCurState(checkObject.GetNextState()); lineObject.SetGoToNext(false); return(flag); } if (st.GetCurState() != st.GetLastState()) { st.UpdateLastState(); flag = CheckOneWholeLine(lineObject, printFlag, st, lexObj, checkObject, updateLex); } else { string line = lineObject.GetLine(); st.UpdateLastState(); ErrMsg.PrintErrMsg(printFlag, 82, lineObject, line, 0, line.Length, checkObject.IsTab()); } return(flag); }
public void It_Should_Delete_Batch_Option() { // Arrange var batchId = CreateBatch(); var createBatchOptionRequest = CreateBatchOptionRequest(batchId); var createBatchOptionResponse = Sut.Post(createBatchOptionRequest); createBatchOptionResponse.Should().NotBeNull(); var request = DeleteBatchOptionRequest(batchId); // Act var response = Sut.Delete(request); // Assert response.Should().NotBeNull(); try { Sut.Get(GetBatchOptionRequest(batchId)); Assert.Fail("Batch should not exist"); } catch (WebServiceException webEx) { webEx.StatusCode.Should().Be((int)HttpStatusCode.NotFound); webEx.Message.Should().Be(ErrMsg.BatchOptionNotFound(request.OptionName)); } }
public HttpResponseMessage Upload() { HttpPostedFile file = HttpContext.Current.Request.Files["school"]; ErrMsg msg = new ErrMsg(); IImport import = ExcelFactory.Instance().GetExcelImporter(new eh.impls.configurations.ExcelConfiguration(1, 0, 0), msg); IList <School> list = SchoolDto.ToList(import.Import <SchoolDto>(file.InputStream)); if (msg.Count != 0) { return(ToJson(msg.GetErrors(), status_code: 0, msg: "fail")); } else { try { Service.Add(list); return(ToJson("success")); } catch (SqlException ex) { msg.AddErrMsg(ex.Message); return(ToJson(msg.GetErrors(), status_code: 0, msg: "fail")); } } }
private void SetOnErrMsg(ErrMsg errMsg) { LabelErrMsg.Visible = true; LabelErrMsg.Text = errMsg.ErrorMessage; LabelErrorCode.Visible = true; LabelErrorCode.Text = errMsg.ErrorId; }
public JsonResult GetNoNPWPCounter() { bool blnResult; string strNoDocNPWP, ErrMsg; blnResult = cls.ReksaGetNoNPWPCounter(out strNoDocNPWP, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetNoNPWPCounter - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, strNoDocNPWP })); }
public JsonResult CheckSubsType([FromQuery] string CIFNo, [FromQuery] int ProductId, [FromQuery] bool IsTrxTA, [FromQuery] bool IsRDB) { bool blnResult; string ErrMsg; blnResult = cls.ReksaCheckSubsType(CIFNo, ProductId, IsTrxTA, IsRDB, out bool IsSubsNew, out string strClientCode, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaCheckSubsType - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, IsSubsNew, strClientCode })); }
public JsonResult ProsesJurnalRTGSSKN([FromQuery] int NIK, [FromQuery] string Module, [FromQuery] string GUID) { bool blnResult; string ErrMsg; blnResult = cls.ReksaProsesJurnalRTGSSKN(NIK, Module, GUID, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaProsesJurnalRTGSSKN - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg })); }
public JsonResult NFSGenerateFileDownload([FromQuery] string FileCode, [FromQuery] string FileName, [FromQuery] string xmlData, [FromQuery] string UserID) { bool blnResult; string ErrMsg; blnResult = cls.ReksaNFSGenerateFileDownload(FileCode, FileName, xmlData, UserID, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaNFSGenerateFileDownload - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg })); }
public JsonResult MaintainBlokir([FromQuery] string BlockDesc, [FromQuery] bool isAccepted, [FromQuery] int NIK, [FromQuery] string GUID, [FromBody] CustomerBlokirModel model) { bool blnResult; string ErrMsg; blnResult = cls.ReksaMaintainBlokir(model, BlockDesc, isAccepted, NIK, GUID, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaMaintainBlokir - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg })); }
public JsonResult GetMandatoryFieldStatus([FromQuery] long CIFNo) { bool blnResult; string ErrMsg, ErrorMessage; blnResult = cls.ReksaGetMandatoryFieldStatus(CIFNo, out ErrMsg, out ErrorMessage); ErrMsg = ErrMsg.Replace("ReksaGetMandatoryFieldStatus - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, ErrorMessage })); }
public JsonResult PopulateNAVParameter([FromBody] UploadNAV model, [FromQuery] int NIK, [FromQuery] string Guid) { bool blnResult; string ErrMsg; blnResult = cls.ReksaPopulateNAVParameter(model, NIK, Guid, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaPopulateNAVParameter - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg })); }
public JsonResult SPProcess([FromQuery] string SPName, [FromQuery] int ProcessId, [FromQuery] int NIK, [FromQuery] string Guid) { bool blnResult; string ErrMsg; blnResult = cls.SPProcess(SPName, ProcessId, NIK, Guid, out ErrMsg); ErrMsg = ErrMsg.Replace(SPName + " - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg })); }
internal void _SetWidth(int cx) { if (cx < 0) { throw new ArgumentOutOfRangeException("cx", cx, ErrMsg.NegVal()); } this.cxWidth = cx; }
/// <summary> /// CLI program entry point which defines command verbs and options to running /// </summary> /// <param name="args"></param> static int Main(string[] args) { int finalResult = (int)Utils.ExitCode.CriticalError; Utils.CLIExecutionContext = true;//set manually at start from CLI WriteOnce.Verbosity = WriteOnce.ConsoleVerbosity.Medium; try { var argsResult = Parser.Default.ParseArguments <AnalyzeCommandOptions, TagDiffCommandOptions, TagTestCommandOptions, ExportTagsCommandOptions, VerifyRulesCommandOptions, PackRulesCommandOptions>(args) .MapResult( (AnalyzeCommandOptions opts) => RunAnalyzeCommand(opts), (TagDiffCommandOptions opts) => RunTagDiffCommand(opts), (TagTestCommandOptions opts) => RunTagTestCommand(opts), (ExportTagsCommandOptions opts) => RunExportTagsCommand(opts), (VerifyRulesCommandOptions opts) => RunVerifyRulesCommand(opts), (PackRulesCommandOptions opts) => RunPackRulesCommand(opts), errs => 1 ); finalResult = argsResult; } catch (Exception) //a controlled exit; details not req but written out in command to ensure NuGet+CLI both can console write and log the error { if (!String.IsNullOrEmpty(Utils.LogFilePath)) { WriteOnce.Info(ErrMsg.FormatString(ErrMsg.ID.RUNTIME_ERROR_NAMED, Utils.LogFilePath), true, WriteOnce.ConsoleVerbosity.Low, false); } else { WriteOnce.Info(ErrMsg.GetString(ErrMsg.ID.RUNTIME_ERROR_PRELOG), true, WriteOnce.ConsoleVerbosity.Medium, false); } return(finalResult);//avoid double reporting } if (finalResult == (int)Utils.ExitCode.CriticalError) //case where exception not thrown but result was still a failure; Run() vs constructor exception etc. { if (!String.IsNullOrEmpty(Utils.LogFilePath)) { WriteOnce.Info(ErrMsg.FormatString(ErrMsg.ID.RUNTIME_ERROR_UNNAMED, Utils.LogFilePath), true, WriteOnce.ConsoleVerbosity.Low, false); } else { WriteOnce.Info(ErrMsg.GetString(ErrMsg.ID.RUNTIME_ERROR_PRELOG), true, WriteOnce.ConsoleVerbosity.Medium, false); } } return(finalResult); }
public JsonResult GetDocStatus([FromQuery] string CIFNo) { bool blnResult; string ErrMsg; string strDocTermCond, strDocRiskProfile; blnResult = cls.ReksaGetDocStatus(CIFNo, out strDocTermCond, out strDocRiskProfile, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetDocStatus - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, strDocTermCond, strDocRiskProfile })); }
public JsonResult GenShareholderId() { string shareholderID; bool blnResult; string ErrMsg; blnResult = cls.ReksaGenerateShareholderID(out shareholderID, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGenerateShareholderID - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, shareholderID })); }
public JsonResult PopulateJurnalRTGS([FromQuery] int ClassificationId, [FromQuery] string Module) { bool blnResult; string ErrMsg; DataSet dsResult = new DataSet(); blnResult = cls.ReksaPopulateJurnalRTGS(ClassificationId, Module, out dsResult, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaPopulateJurnalRTGS - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, dsResult })); }
public JsonResult GetListClientRDB([FromQuery] string ClientCode) { bool blnResult; string ErrMsg; List <CustomerAktifitasModel.ClientRDB> listClientRDB = new List <CustomerAktifitasModel.ClientRDB>(); blnResult = cls.ReksaGetListClientRDB(ClientCode, ref listClientRDB, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetListClientRDB - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listClientRDB })); }
public JsonResult RefreshProdNAV([FromQuery] int ProductId, [FromQuery] int NIK, [FromQuery] string GUID) { bool blnResult; string ErrMsg; List <ProductNAV> listProductNAV = new List <ProductNAV>(); blnResult = cls.ReksaRefreshProdNAV(ProductId, NIK, GUID, out listProductNAV, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaRefreshProdNAV - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listProductNAV })); }
public JsonResult GetListClient([FromQuery] string CIFNO) { bool blnResult; string ErrMsg; List <CustomerAktifitasModel.ClientList> listClient = new List <CustomerAktifitasModel.ClientList>(); blnResult = cls.ReksaGetListClient(CIFNO, ref listClient, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetListClient - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listClient })); }
public JsonResult KYCGenerateText([FromQuery] int NIK, [FromQuery] string Module, [FromQuery] string Jenis, [FromQuery] int Bulan, [FromQuery] int Tahun) { bool blnResult; string ErrMsg; DataSet dsResult = new DataSet(); blnResult = cls.ReksaGenerateText(NIK, Module, Jenis, Bulan, Tahun, out ErrMsg, out dsResult); ErrMsg = ErrMsg.Replace("ReksaGenerateText - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, dsResult })); }
public JsonResult NFSGetFormatFile([FromQuery] string FileCode) { bool blnResult = false; string ErrMsg; DataSet dsData = new DataSet(); blnResult = cls.ReksaNFSGetFormatFile(FileCode, out dsData, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaNFSGetFormatFile - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, dsData })); }
public JsonResult NFSGenerateFileUpload([FromQuery] string FileCode, [FromQuery] int TranDate) { bool blnResult; string ErrMsg; DataSet ds = new DataSet(); blnResult = cls.ReksaNFSGenerateFileUpload(FileCode, TranDate, out ds, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaNFSGenerateFileUpload - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, ds })); }
public JsonResult CalculateSwitchingFee([FromBody] CalculateFeeModel.SwitchingRequest model) { bool blnResult; string ErrMsg; CalculateFeeModel.SwitchingResponses resultFee = new CalculateFeeModel.SwitchingResponses(); blnResult = cls.ReksaCalcSwitchingFee(model, out resultFee, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaCalcSwitchingFee - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, resultFee })); }
public JsonResult UploadWAPERD([FromBody] UploadWaperd model, [FromQuery] int NIK, [FromQuery] string Module) { bool blnResult; string ErrMsg; DataSet dsError = new DataSet(); blnResult = cls.ReksaUploadWAPERD(model, NIK, Module, out ErrMsg, out dsError); ErrMsg = ErrMsg.Replace("ReksaUploadWAPERD - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, dsError })); }
public JsonResult ValidateGL([FromQuery] int NIK, [FromQuery] string Module, [FromQuery] string NomorGL) { bool blnResult; string ErrMsg; string strNamaGL; blnResult = cls.ReksaValidateGL(NIK, Module, NomorGL, out strNamaGL, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaValidateGL - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, strNamaGL })); }
public JsonResult RefreshSwitchingRDB([FromQuery] string RefID, [FromQuery] int NIK, [FromQuery] string GUID) { bool blnResult; string ErrMsg; List <TransactionModel.SwitchingRDBModel> listDetailSwcRDB = new List <TransactionModel.SwitchingRDBModel>(); blnResult = cls.ReksaRefreshSwitchingRDB(RefID, NIK, GUID, ref listDetailSwcRDB, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaRefreshSwitchingRDB - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listDetailSwcRDB })); }
public JsonResult GetDropDownList([FromQuery] string ListName) { bool blnResult = false; string ErrMsg; List <ParamSinkronisasi> listParam = new List <ParamSinkronisasi>(); blnResult = cls.ReksaGetDropDownList(ListName, out listParam, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetDropDownList - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listParam })); }
public JsonResult GetAlamatCabang([FromQuery] string Branch, [FromQuery] string CIFNO, [FromQuery] int Id) { bool blnResult; string ErrMsg; List <CustomerIdentitasModel.AlamatCabangDetail> listBranchAddress = new List <CustomerIdentitasModel.AlamatCabangDetail>(); blnResult = cls.ReksaGetAlamatCabang(Branch, CIFNO, Id, ref listBranchAddress, out ErrMsg); ErrMsg = ErrMsg.Replace("ReksaGetAlamatCabang - Core .Net SqlClient Data Provider\n", ""); return(Json(new { blnResult, ErrMsg, listBranchAddress })); }
public string GetListFolders(int FolderID, int DeepLevel) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); string xml = GetListFoldersXml(FolderID, DeepLevel); errMsg.msg = "OK"; return xml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public void UpdateCategoryList(int ObjectType, string UpdateList) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); WebServicesHelper.UpdateCategoryList(ObjectType, UpdateList); errMsg.msg = "OK"; return; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return; } catch (Exception ex) { errMsg.msg = ex.Message; return; } }
public string GetGroupList() { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ////////////////////////////////////////////////////////////////////////// /* <Groups> <Group> <GroupId> <GroupName> <Level> </Group> ... <Groups> */ XmlDocument xmlGroupList = new XmlDocument(); xmlGroupList.LoadXml("<Groups></Groups>"); XmlNode xmlGroupsNode = xmlGroupList.SelectSingleNode("Groups"); // Get All Available Group [1/27/2004] using (IDataReader groupReader = SecureGroup.GetListGroupsAsTree()) { while (groupReader.Read()) { XmlElement groupNode = xmlGroupList.CreateElement("Group"); ////////////////////////////////////////////////////////////////////////// XmlElement GroupIDNode = xmlGroupList.CreateElement("GroupId"); XmlElement GroupNameNode = xmlGroupList.CreateElement("GroupName"); XmlElement LevelNode = xmlGroupList.CreateElement("Level"); GroupIDNode.InnerText = groupReader["GroupId"].ToString(); GroupNameNode.InnerText = Mediachase.UI.Web.Util.CommonHelper.GetResFileString(groupReader["GroupName"].ToString()); LevelNode.InnerText = groupReader["Level"].ToString(); ////////////////////////////////////////////////////////////////////////// groupNode.AppendChild(GroupIDNode); groupNode.AppendChild(GroupNameNode); groupNode.AppendChild(LevelNode); xmlGroupsNode.AppendChild(groupNode); } } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return xmlGroupList.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public long CreateProject(string title, string description, string goals, string scope, string deliverable, int manager_id, int exmanager_id, DateTime start_date, DateTime finish_date, int status_id, int type_id, int calendar_id, int client_id, int currency_id, int[] ProjectCategory, int[] Resources) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList categories = new ArrayList(); ArrayList project_categories = new ArrayList(ProjectCategory); ArrayList alResources = new ArrayList(Resources); ArrayList alPort = new ArrayList(); start_date = start_date.ToUniversalTime(); finish_date = finish_date.ToUniversalTime(); int phase_id = 1; using (IDataReader reader = Project.GetListProjectPhases()) { if (reader.Read()) { phase_id = (int)reader["PhaseId"]; } } ObjectId = Project.CreateUseUniversalTime(title, description, goals, scope, deliverable, manager_id, exmanager_id, start_date, finish_date, DateTime.MinValue, DateTime.MinValue, status_id, type_id, calendar_id, PrimaryKeyId.Empty, PrimaryKeyId.Empty, currency_id, phase_id, phase_id, 0, 1, 1, categories, project_categories, alPort, alResources, true); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public string ExportIBNProject(int ProjectID) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); string ProjectXML; if (Project.GetIsMSProject(ProjectID)) { ////////////////////////////////////////////////////////////////////////// // [4/14/2008] ProjectXML = Task.TaskExport2(ProjectID).InnerXml; ////////////////////////////////////////////////////////////////////////// } else { ////////////////////////////////////////////////////////////////////////// // [1/19/2004] ProjectXML = IBNPrj2XML.IBN2XML(ProjectID).InnerXml; ////////////////////////////////////////////////////////////////////////// } errMsg.msg = "OK"; return ProjectXML; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public void ImportMsProject(int ProjectId, string MsProjectImportXml) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); bool bSyncMode = false; if (ProjectId < 0) { ProjectId *= -1; bSyncMode = true; } if (Project.GetIsMSProject(ProjectId) || bSyncMode) { ///////////////////////////////////////////////////////////////////////// // OlegO [4/14/2008] System.IO.MemoryStream memStream = new System.IO.MemoryStream(); System.IO.StreamWriter writer = new System.IO.StreamWriter(memStream); writer.Write(MsProjectImportXml); memStream.Seek(0, System.IO.SeekOrigin.Begin); int dataFileId = Project.UploadImportXML(ProjectId, "ImportIBNProject.xml", memStream); DataTable taskAssignments = Task.TaskImportAssignments(ProjectId, dataFileId); Task.TasksImport2(taskAssignments, ProjectId, dataFileId, CompletionType.All, true); ////////////////////////////////////////////////////////////////////////// } else { ////////////////////////////////////////////////////////////////////////// // OlegO [4/29/2004] System.IO.MemoryStream memStream = new System.IO.MemoryStream(); System.IO.StreamWriter writer = new System.IO.StreamWriter(memStream); writer.Write(MsProjectImportXml); memStream.Seek(0, System.IO.SeekOrigin.Begin); int XMLVersionID = Project.UploadImportXML(ProjectId, "ImportIBNProject.xml", memStream); DataTable taskAssignments = Task.TaskImportAssignments(ProjectId, XMLVersionID); Task.TasksImport(taskAssignments, ProjectId, XMLVersionID); ////////////////////////////////////////////////////////////////////////// } errMsg.msg = "OK"; return; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return; } catch (Exception ex) { errMsg.msg = ex.Message; return; } }
public long CreateTask(string Title, string Description, int ProjectId, DateTime StartDate, DateTime EndDate, bool IsMilestone, int Priority, int CompletionTypeId, bool MustBeConfirmedByManager, int[] Resources) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList alCategories = Mediachase.IBN.Business.Common.StringToArrayList(PortalConfig.TaskDefaultValueGeneralCategoriesField); ArrayList alResources = new ArrayList(Resources); StartDate = StartDate.ToUniversalTime(); EndDate = EndDate.ToUniversalTime(); ObjectId = Task.CreateUseUniversalTime(ProjectId, Title, Description, StartDate, EndDate, Priority, IsMilestone, int.Parse(PortalConfig.TaskDefaultValueActivationTypeField), CompletionTypeId, MustBeConfirmedByManager, alCategories, alResources); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public long CreateProject47( string title, string description, string goals, string scope, string deliverable, int manager_id, int exmanager_id, DateTime start_date, DateTime finish_date, int status_id, int type_id, int calendar_id, string ñontactUid, string orgUid, int currency_id, int priority_id, int phase_id, int[] ProjectCategory, int[] Resources, int[] ProjectPortfolio, int TimeTrackingTemplateId) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList categories = new ArrayList(); ArrayList project_categories = new ArrayList(ProjectCategory); ArrayList alResources = new ArrayList(Resources); ArrayList alPort = new ArrayList(ProjectPortfolio); start_date = start_date.ToUniversalTime(); finish_date = finish_date.ToUniversalTime(); ObjectId = Project.CreateUseUniversalTime(title, description, goals, scope, deliverable, manager_id, exmanager_id, start_date, finish_date, DateTime.MinValue, DateTime.MinValue, status_id, type_id, calendar_id, PrimaryKeyId.Parse(ñontactUid), PrimaryKeyId.Parse(orgUid), currency_id, priority_id, phase_id, phase_id, 0, 1, TimeTrackingTemplateId, categories, project_categories, alPort, alResources, true); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public string GetListFieldTemplate(int TemplateId) { try { string ret = string.Empty; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ret = string.Empty; errMsg.msg = "OK"; return ret; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public void CreateListFields(int ListID, string xmlFields) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); throw new NotImplementedException(); //WebServicesHelper.CreateListFields(ListID, xmlFields); //errMsg.msg = "OK"; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; } catch (Exception ex) { errMsg.msg = ex.Message; } }
public long CreateIncident47(string Title, string Description, int ProjectId, int TypeId, int Priority, int SeverityId, int[] IncidentCategory, int IncidentBoxId, string ContactUid, string OrgUid, string SenderEmail) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); if (IncidentBoxId <= 0) { // Calculate Incident box Mediachase.IBN.Business.EMail.IncidentInfo info = new Mediachase.IBN.Business.EMail.IncidentInfo(); info.Description = Description; info.GeneralCategories = new ArrayList(); info.IncidentCategories = new ArrayList(IncidentCategory); info.PriorityId = Priority; info.SeverityId = SeverityId; info.Title = Title; info.TypeId = TypeId; info.MailSenderEmail = SenderEmail??string.Empty; info.ContactUid = PrimaryKeyId.Parse(ContactUid); info.OrgUid = PrimaryKeyId.Parse(OrgUid); info.CreatorId = Security.CurrentUser.UserID; IncidentBoxId = IncidentBoxRule.Evaluate(info).IncidentBoxId; } ObjectId = Incident.Create(Title, Description, ProjectId, TypeId, Priority, SeverityId, int.Parse(PortalConfig.IncidentDefaultValueTaskTimeField), 0, 0, 0, Security.CurrentUser.UserID, Mediachase.IBN.Business.Common.StringToArrayList(PortalConfig.IncidentDefaultValueGeneralCategoriesField), new ArrayList(IncidentCategory), null, null, false, DateTime.UtcNow, IncidentBoxId, PrimaryKeyId.Parse(ContactUid), PrimaryKeyId.Parse(OrgUid)); // OZ 2008-08-19: Append email sender if(!string.IsNullOrEmpty(SenderEmail)) EMailIssueExternalRecipient.Create(ObjectId, SenderEmail); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public long CreateListFromExcel(string excelPath, string SheetName, string title, string description, int folderId, int typeId, int statusId, int[] listCategory, string[] filter, bool ignoreErrors) { int listId = -1; try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList alCategories = new ArrayList(listCategory); ArrayList alFilter = new ArrayList(filter); using (TransactionScope tran = DataContext.Current.BeginTransaction()) { //listId = WebServicesHelper.CreateAndFillList(excelPath, SheetName, title, description, folderId, typeId, statusId, alCategories, alFilter, ignoreErrors); //DataSet externalData = null; IMCOleDBHelper helper = (IMCOleDBHelper)Activator.GetObject(typeof(IMCOleDBHelper), ConfigurationManager.AppSettings["McOleDbServiceString"]); DataSet externalData = helper.ConvertExcelToDataSet(excelPath); ListImportParameters param = new ListImportParameters(folderId, title, externalData, externalData.Tables.IndexOf(SheetName)); param.Description = description; MappingError[] errors = ListManager.Import(param); // OZ 2009-01-27 Update retval value if(param.CreatedListId.HasValue) listId = param.CreatedListId.Value; tran.Commit(); } errMsg.msg = "OK"; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; } catch (Exception ex) { //errMsg.msg = ex.Message; errMsg.msg = ex.ToString(); } return listId; }
public void updateProjectFromTemplate(int ProjectId, int TemplateId, string[] assignments) { /* assignments are pairs of principle id(user id) and role id separeted by ":" */ if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; try { Authenticate(); DataTable table = new DataTable(); table.Columns.Add("RoleId", typeof(int)); table.Columns.Add("PrincipalId", typeof(int)); foreach (string assignment in assignments) { string[] ids = assignment.Split(new char[] { ':' }); int principle_id = int.Parse(ids[0]); int role_id = int.Parse(ids[1]); table.Rows.Add(new object[] { role_id, principle_id }); } Task.MakeProjectFromTemplate(TemplateId, ProjectId, table); errMsg.msg = "OK"; return; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; } catch (Exception ex) { errMsg.msg = ex.Message; } }
public long CreateList(int TemplateId, string Title, string Description, int FolderID, int TypeId, int StatusId, int[] ListCategory) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); //ArrayList alCategories = new ArrayList(ListCategory); //ObjectId = Mediachase.IBN.Business.List.AddList(TemplateId, Title, Description, FolderID, TypeId, StatusId, alCategories); using(TransactionScope tran = DataContext.Current.BeginTransaction()) { if(TemplateId<=0) { ListInfo info = ListManager.CreateList(FolderID, Title); info.Description = Description; info.ListType = TypeId; info.Status = StatusId; info.Save(); ObjectId = info.PrimaryKeyId.Value; } else { ListInfo info = ListManager.CreateListFromTemplate(TemplateId, FolderID, Title, true); info.Description = Description; info.ListType = TypeId; info.Status = StatusId; info.Save(); ObjectId = info.PrimaryKeyId.Value; } tran.Commit(); } errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public string GetIBNProjectList2(int ObjectType) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ////////////////////////////////////////////////////////////////////////// /* <Projects> <Managers> <User> <UserId> <FirstName> <LastName> <User> <Managers> <Project> <!-- IBN Compatibility 3.0 --> <ObjectID/> <Title/> <Manager> <User> <UserId> <FirstName> <LastName> <User> <Manager> </Project> ... <Projects> */ XmlDocument xmlProjectList = new XmlDocument(); xmlProjectList.LoadXml("<Projects><Managers></Managers></Projects>"); XmlNode xmlProjectsNode = xmlProjectList.SelectSingleNode("Projects"); using (IDataReader projectListReader = GetProjectsReader(ObjectType)) { // Step 1. Create Project List [1/30/2004] while (projectListReader.Read()) { // Reaad Only Active Project int statusId = (int)projectListReader["StatusId"]; if (statusId != 1 && statusId != 5 && statusId != 4) continue; XmlElement projectNode = xmlProjectList.CreateElement("Project"); ////////////////////////////////////////////////////////////////////////// XmlElement ObjectIDNode = xmlProjectList.CreateElement("ObjectID"); XmlElement TitleNode = xmlProjectList.CreateElement("Title"); XmlElement ManagerNode = xmlProjectList.CreateElement("Manager"); // XmlElement DateCreatedNode = xmlProjectList.CreateElement("DateCreated"); // XmlElement CreatorNode = xmlProjectList.CreateElement("Creator"); // XmlElement StartDateNode = xmlProjectList.CreateElement("StartDate"); // XmlElement EndDateNode = xmlProjectList.CreateElement("EndDateID"); // XmlElement ManagerCanonNameNode = xmlProjectList.CreateElement("ManagerCanonName"); // XmlElement DescriptionNode = xmlProjectList.CreateElement("Description"); ////////////////////////////////////////////////////////////////////////// int ProjectId = (int)projectListReader["ProjectId"]; ObjectIDNode.InnerText = ProjectId.ToString(); TitleNode.InnerText = projectListReader["Title"].ToString(); InsertUserInformation(ManagerNode, Project.GetProjectManager(ProjectId)); // DateCreatedNode.InnerText = projectListReader["CreationDate"].ToString(); // // UserLight creator = new UserLight((int)projectListReader["CreatorId"]); // CreatorNode.InnerText = string.Format("{0} {1}",creator.FirstName,creator.LastName); // // StartDateNode.InnerText = projectListReader["StartDate"].ToString(); // EndDateNode.InnerText = projectListReader["FinishDate"].ToString(); // // UserLight manager = new UserLight((int)projectListReader["ManagerId"]); // ManagerCanonNameNode.InnerText = string.Format("{0} {1}",manager.FirstName,manager.LastName); // // DescriptionNode.InnerText = projectListReader["Description"].ToString(); ////////////////////////////////////////////////////////////////////////// projectNode.AppendChild(ObjectIDNode); projectNode.AppendChild(TitleNode); projectNode.AppendChild(ManagerNode); // projectNode.AppendChild(DateCreatedNode); // projectNode.AppendChild(CreatorNode); // projectNode.AppendChild(DateCreatedNode); // projectNode.AppendChild(StartDateNode); // projectNode.AppendChild(EndDateNode); // projectNode.AppendChild(ManagerCanonNameNode); // projectNode.AppendChild(DescriptionNode); ////////////////////////////////////////////////////////////////////////// xmlProjectsNode.AppendChild(projectNode); } } // Step 2. Build Manager List [1/30/2004] XmlNode ManagersList = xmlProjectList.SelectSingleNode("Projects/Managers"); if (Security.IsUserInGroup(InternalSecureGroups.PowerProjectManager)) { using (IDataReader managerReader = SecureGroup.GetListAllUsersInGroup((int)InternalSecureGroups.ProjectManager)) { while (managerReader.Read()) { InsertUserInformation(ManagersList, (int)managerReader["UserId"]); } } } else { InsertUserInformation(ManagersList, Security.CurrentUser.UserID); } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return xmlProjectList.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public long CreateIncident(string Title, string Description, int ProjectId, int TypeId, int Priority, int SeverityId, int[] IncidentCategory) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); PrimaryKeyId org_id = PrimaryKeyId.Empty; PrimaryKeyId contact_id = PrimaryKeyId.Empty; Mediachase.IBN.Business.Common.GetDefaultClient(PortalConfig.IncidentDefaultValueClientField, out contact_id, out org_id); ObjectId = Incident.Create(Title, Description, ProjectId, TypeId, Priority, SeverityId, int.Parse(PortalConfig.IncidentDefaultValueTaskTimeField), 0, 0, 0, Security.CurrentUser.UserID, Mediachase.IBN.Business.Common.StringToArrayList(PortalConfig.IncidentDefaultValueGeneralCategoriesField), new ArrayList(IncidentCategory), null, null, false, DateTime.UtcNow, -1, contact_id, org_id); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public string FileLibraryDir(int FolderID, bool bIncludeAsset, int DeepLevel) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ////////////////////////////////////////////////////////////////////////// XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<DirList><Projects/></DirList>"); XmlNode dirlistNode = xmlDoc.SelectSingleNode("DirList"); XmlNode dirlistNodePrj = xmlDoc.SelectSingleNode("DirList/Projects"); string ContainerName = "FileLibrary"; string ContainerKey = "Workspace"; BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); Mediachase.IBN.Business.ControlSystem.DirectoryInfo dir = fs.Root; if (FolderID != 0) dir = fs.GetDirectory(FolderID); // Recursive Create XML RecursiveCreateXML(fs, dirlistNode, dir.Id, bIncludeAsset, DeepLevel, 0, -1); if (FolderID == 0) { DataTable dt = Project.GetListActiveProjectsByUserDataTable(); foreach (DataRow dr in dt.Select(string.Empty, "Title ASC")) { ContainerKey = Mediachase.IBN.Business.UserRoleHelper.CreateProjectContainerKey((int)dr["ProjectId"]); bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); dir = fs.Root; XmlNode folderItem = InsertFolderInformation(fs, dirlistNodePrj, dir, dr["Title"].ToString(), (int)dr["ProjectId"]); if (folderItem != null) { XmlNode childFolderItem = folderItem.SelectSingleNode("ChildList"); RecursiveCreateXML(fs, childFolderItem, dir.Id, bIncludeAsset, DeepLevel, 0, (int)dr["ProjectId"]); } } } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return xmlDoc.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public void UpdateDictionaries(string Dictionary) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); WebServicesHelper.UpdateDictionaries(Dictionary); errMsg.msg = "OK"; return; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return; } catch (Exception ex) { errMsg.msg = ex.Message; return; } }
public string GetIBNProjectList() { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ////////////////////////////////////////////////////////////////////////// /* <Projects> <Project> <!-- IBN Compatibility 3.0 --> <ObjectID/> <Title/> <DateCreated/> <Creator/> <StartDate/> <EndDate/> <ManagerCanonName/> <Description/> <IsActive/> </Project> ... <Projects> */ XmlDocument xmlProjectList = new XmlDocument(); xmlProjectList.LoadXml("<Projects></Projects>"); XmlNode xmlProjectsNode = xmlProjectList.SelectSingleNode("Projects"); using (IDataReader projectList = Project.GetListProjectsForPMAndPPM()) { while (projectList.Read()) { // Display only active project list if (!(bool)projectList["IsActive"]) continue; XmlElement projectNode = xmlProjectList.CreateElement("Project"); ////////////////////////////////////////////////////////////////////////// XmlElement ObjectIDNode = xmlProjectList.CreateElement("ObjectID"); XmlElement TitleNode = xmlProjectList.CreateElement("Title"); XmlElement DateCreatedNode = xmlProjectList.CreateElement("DateCreated"); XmlElement CreatorNode = xmlProjectList.CreateElement("Creator"); XmlElement StartDateNode = xmlProjectList.CreateElement("StartDate"); XmlElement EndDateNode = xmlProjectList.CreateElement("EndDate"); XmlElement ManagerCanonNameNode = xmlProjectList.CreateElement("ManagerCanonName"); XmlElement DescriptionNode = xmlProjectList.CreateElement("Description"); XmlElement IsMSProjectNode = xmlProjectList.CreateElement("IsMSProject"); XmlElement IsActiveNode = xmlProjectList.CreateElement("IsActive"); ////////////////////////////////////////////////////////////////////////// ObjectIDNode.InnerText = projectList["ProjectId"].ToString(); TitleNode.InnerText = projectList["Title"].ToString(); DateCreatedNode.InnerText = XmlConvert.ToString((DateTime)projectList["CreationDate"], DateTimeFormatString); UserLight creator = UserLight.Load((int)projectList["CreatorId"]); CreatorNode.InnerText = string.Format("{0} {1}", creator.FirstName, creator.LastName); StartDateNode.InnerText = XmlConvert.ToString((DateTime)projectList["TargetStartDate"], DateTimeFormatString); EndDateNode.InnerText = XmlConvert.ToString((DateTime)projectList["TargetFinishDate"], DateTimeFormatString); UserLight manager = UserLight.Load((int)projectList["ManagerId"]); ManagerCanonNameNode.InnerText = string.Format("{0} {1}", manager.FirstName, manager.LastName); DescriptionNode.InnerText = projectList["Description"].ToString(); IsMSProjectNode.InnerText = projectList["IsMSProject"].ToString(); IsActiveNode.InnerText = projectList["IsActive"].ToString(); ////////////////////////////////////////////////////////////////////////// projectNode.AppendChild(ObjectIDNode); projectNode.AppendChild(TitleNode); projectNode.AppendChild(DateCreatedNode); projectNode.AppendChild(CreatorNode); projectNode.AppendChild(DateCreatedNode); projectNode.AppendChild(StartDateNode); projectNode.AppendChild(EndDateNode); projectNode.AppendChild(ManagerCanonNameNode); projectNode.AppendChild(DescriptionNode); projectNode.AppendChild(IsMSProjectNode); projectNode.AppendChild(IsActiveNode); ////////////////////////////////////////////////////////////////////////// xmlProjectsNode.AppendChild(projectNode); } } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return xmlProjectList.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public string GetRoleList(int TemplateId) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); errMsg.msg = "OK"; return WebServicesHelper.GetRoleList(TemplateId); } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid"; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public string GetCategoryList2(int ObjectType) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); errMsg.msg = "OK"; return WebServicesHelper.GetCategoryList2(ObjectType); } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public void ImportMsProjectStep2SyncMode(int ProjectId, string ImportResourceMapXml) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); /* <ImportConfig> <XMLVersionID>12</XMLVersionID> <ImportAssignments> <Assignment> <ResourceId/> <UserId/> </Assignment> </ImportAssignments> </ImportConfig> */ ////////////////////////////////////////////////////////////////////////// // [4/29/2004] XmlDocument xmlImportConfigDocument = new XmlDocument(); xmlImportConfigDocument.LoadXml(ImportResourceMapXml); XmlNodeList xmlImportAssignmentsList = xmlImportConfigDocument.SelectNodes("ImportConfig/ImportAssignments/Assignment"); DataTable table = new DataTable(); DataColumn Column = table.Columns.Add("ResourceId", typeof(int)); table.PrimaryKey = new DataColumn[] { Column }; table.Columns.Add("ResourceName", typeof(string)); table.Columns.Add("PrincipalId", typeof(int)); foreach (XmlNode xmlAssignmentNode in xmlImportAssignmentsList) { DataRow row = table.NewRow(); row["ResourceId"] = Int32.Parse(xmlAssignmentNode.SelectSingleNode("ResourceId").InnerText); row["ResourceName"] = ""; row["PrincipalId"] = Int32.Parse(xmlAssignmentNode.SelectSingleNode("UserId").InnerText); table.Rows.Add(row); } Task.TasksImport2(table, ProjectId, Int32.Parse(xmlImportConfigDocument.SelectSingleNode("ImportConfig/XMLVersionID").InnerText), CompletionType.All, true); ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return; } catch (Exception ex) { errMsg.msg = ex.Message; return; } }
public string GetResourceListBySubstring(string searchstr) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ////////////////////////////////////////////////////////////////////////// /* <Resources> <User> <UserId> <FirstName> <LastName> </User> ... <Resources> */ XmlDocument xmlResourceList = new XmlDocument(); xmlResourceList.LoadXml("<Resources></Resources>"); XmlNode xmlResourcesNode = xmlResourceList.SelectSingleNode("Resources"); // Get User List for Group [1/27/2004] using (IDataReader teamReader = Mediachase.IBN.Business.User.GetListUsersBySubstring(searchstr)) { while (teamReader.Read()) { InsertUserInformation(xmlResourcesNode, (int)teamReader["UserId"]); } } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return xmlResourceList.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public string LoadDictionaries(string Locale, int ObjectType) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); errMsg.msg = "OK"; if (ObjectTypes.List == (ObjectTypes)ObjectType) { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Locale); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(Locale); string defaultXml = WebServicesHelper.LoadDictionaries(Locale, ObjectType); XmlDocument xmlDictionariesList = new XmlDocument(); xmlDictionariesList.LoadXml(defaultXml); XmlNode xmlDictionariesNode = xmlDictionariesList.SelectSingleNode("Dictionaries"); // ListStatus InsertMetaEnumItems(xmlDictionariesNode, "ListStatus", DataContext.Current.GetMetaFieldType("ListStatus").EnumItems); // ListType InsertMetaEnumItems(xmlDictionariesNode, "ListType", DataContext.Current.GetMetaFieldType("ListType").EnumItems); // ListTemplate XmlNode xmlNewListTemplateNode = xmlDictionariesNode.OwnerDocument.CreateElement("ListTemplate"); foreach (ListInfo info in ListManager.GetTemplates()) { InsertDictionaryItem(xmlNewListTemplateNode, info.Title, info.PrimaryKeyId.Value.ToString()); } xmlDictionariesNode.AppendChild(xmlNewListTemplateNode); return xmlDictionariesList.InnerXml; } else return WebServicesHelper.LoadDictionaries(Locale, ObjectType); } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public long CreateEvent47(string Title, string Location, string Description, int ProjectId, int ManagerId, DateTime StartDate, DateTime EndDate, int Priority, int TypeId, int ReminderInterval, string ContactUid, string OrgUid, int[] Resources) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList alCategories = Mediachase.IBN.Business.Common.StringToArrayList(PortalConfig.CEntryDefaultValueGeneralCategoriesField); ArrayList alResources = new ArrayList(Resources); StartDate = StartDate.ToUniversalTime(); EndDate = EndDate.ToUniversalTime(); ObjectId = CalendarEntry.CreateUseUniversalTime(Title, Description, Location, ProjectId, ManagerId, Priority, TypeId, StartDate, EndDate, alCategories, null, null, alResources, PrimaryKeyId.Parse(ContactUid), PrimaryKeyId.Parse(OrgUid)); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }
public string ImportMsProjectStep1(int ProjectId, string MsProjectImportXml) { try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); // bool bSyncMode = false; if (ProjectId < 0) { ProjectId *= -1; // bSyncMode = true; } ////////////////////////////////////////////////////////////////////////// System.IO.MemoryStream memStream = new System.IO.MemoryStream(); System.IO.StreamWriter writer = new System.IO.StreamWriter(memStream); writer.Write(MsProjectImportXml); writer.Flush(); memStream.Seek(0, System.IO.SeekOrigin.Begin); if (!Util.CommonHelper.ValidateXMLWithMsProjectSchema(new XmlTextReader(memStream))) { throw new Exception("The XML File has an invalid format."); } memStream.Seek(0, System.IO.SeekOrigin.Begin); // [1/19/2004] // Step 1. We add a XML to the IBN Project [4/27/2004] int XMLVersionID = Project.UploadImportXML(ProjectId, "ImportIBNProjectStep1.xml", memStream); // Step 2. Read Project Datatable [4/27/2004] // !!Attention DataTable taskAssignments = Task.TaskImportAssignments(ProjectId, XMLVersionID); // Step 3. Create a output XML [4/27/2004] XmlDocument outputXml = new XmlDocument(); outputXml.LoadXml("<ImportConfig><XMLVersionID/><Resources/><ImportAssignments/></ImportConfig>"); /* <ImportConfig> <XMLVersionID>12</XMLVersionID> <Resources> <User> <UserId> <FirstName> <LastName> </User> ... <Resources> <ImportAssignments> <Assignment> <ResourceId/> <ResourceName/> <UserId/> </Assignment> </ImportAssignments> ... </ImportConfig> */ //<XMLVersionID>12</XMLVersionID> outputXml.SelectSingleNode("ImportConfig/XMLVersionID").InnerText = XMLVersionID.ToString(); //<Resources> XmlNode xmlResourcesNode = outputXml.SelectSingleNode("ImportConfig/Resources"); // Get User List for Group [1/27/2004] using (IDataReader teamReader = Project.GetListTeamMemberNames(ProjectId)) { while (teamReader.Read()) { InsertUserInformation(xmlResourcesNode, (int)teamReader["UserId"]); } } //<ImportAssignments> XmlNode xmlImportAssignmentsNode = outputXml.SelectSingleNode("ImportConfig/ImportAssignments"); foreach (DataRow dr in taskAssignments.Rows) { int ResourceId = (int)dr["ResourceId"]; string ResourceName = (string)dr["ResourceName"]; int PrincipalId = (int)dr["PrincipalId"]; XmlNode xmlAssignmentNode = outputXml.CreateElement("Assignment"); XmlNode xmlResourceIdNode = outputXml.CreateElement("ResourceId"); XmlNode xmlResourceNameNode = outputXml.CreateElement("ResourceName"); XmlNode xmlPrincipalIdNode = outputXml.CreateElement("UserId"); xmlResourceIdNode.InnerText = ResourceId.ToString(); xmlResourceNameNode.InnerText = ResourceName.ToString(); xmlPrincipalIdNode.InnerText = PrincipalId.ToString(); xmlAssignmentNode.AppendChild(xmlResourceIdNode); xmlAssignmentNode.AppendChild(xmlResourceNameNode); xmlAssignmentNode.AppendChild(xmlPrincipalIdNode); xmlImportAssignmentsNode.AppendChild(xmlAssignmentNode); } ////////////////////////////////////////////////////////////////////////// errMsg.msg = "OK"; return outputXml.InnerXml; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return ""; } catch (Exception ex) { errMsg.msg = ex.Message; return ""; } }
public int CheckFileName(int ObjectTypeId, int ObjectId, string FileName) { bool exists = false; try { if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); exists = WebServicesHelper.CheckFileName(ObjectTypeId, ObjectId, FileName); errMsg.msg = "OK"; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; } catch (Exception ex) { //errMsg.msg = ex.Message; errMsg.msg = ex.ToString(); } return exists ? -1 : 0; }
public long CreateToDo47(string Title, string Description, int ProjectId, int ManagerId, DateTime StartDate, DateTime EndDate, int DateFlag, int Priority, int CompletionTypeId, bool MustBeConfirmedByManager, string ContactUid, string OrgUid, int[] Resources) { try { int ObjectId = -1; if (errMsg == null) errMsg = new ErrMsg(); errMsg.DidUnderstand = true; Authenticate(); ArrayList alResources = new ArrayList(Resources); StartDate = StartDate.ToUniversalTime(); EndDate = EndDate.ToUniversalTime(); ObjectId = Mediachase.IBN.Business.ToDo.CreateUseUniversalTime(ProjectId, ManagerId, Title, Description, (DateFlag & 1) == 0 ? DateTime.MinValue : StartDate, (DateFlag & 2) == 0 ? DateTime.MinValue : EndDate, Priority, (int)ActivationTypes.AutoWithCheck, CompletionTypeId, MustBeConfirmedByManager, -1, new ArrayList(), null, null, alResources, PrimaryKeyId.Parse(ContactUid), PrimaryKeyId.Parse(OrgUid)); errMsg.msg = "OK"; return ObjectId; } catch (UserNotAuthenticatedException) { errMsg.msg = "Your login or password is invalid."; return -1; } catch (Exception ex) { errMsg.msg = ex.Message; return -1; } }