Example #1
0
        public string Get(int userID, string session, string funcPara)
        {
            //string pInput = string.Format("<InputValue UserID=\"{0}\" Session=\"{1}\" {2}/>", userId, session, funcPara);
            string        InputValue = CXmlPara.CreatePara(funcPara);
            CAccountList  account    = service.GetAccount(InputValue);
            StringBuilder ret        = new StringBuilder();

            if (account != null)
            {
                ret.Append("{");
                try
                {
                    ret.AppendFormat("ID:'{0}',\n", account.ID);
                    ret.AppendFormat("Code:'{0}',\n", account.Code);
                    ret.AppendFormat("Name:'{0}',\n", account.Name);
                    ret.AppendFormat("ParentID:'{0}',\n", account.ParentID);
                    ret.AppendFormat("Type:'{0}'\n", account.ParentID);
                }
                catch (Exception ex)
                {
                    CLogManager.Write("ChartAccountUI:Get(int, string, string)", ex.ToString(), "Account");
                }
                ret.Append("}");
            }
            else
            {
                ret.Append("{}");
            }
            return(ret.ToString());
        }
Example #2
0
        public static DataSet ToDataset(string xmlData)
        {
            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml(new StringReader(xmlData));
            }
            catch (Exception ex)
            {
                CLogManager.Write("PMSA.Framework.Database.ToDataset(string xml)", ex.Message, "Database");
            }
            return(ds);
        }
Example #3
0
        private static string LoadTreeGrid(string exAttribute, int pLevel, int pParentId)
        {
            string inputValue = CXmlPara.CreatePara(new CPara[] { new CPara("FilterCode", "Employee") }, exAttribute);

            ServiceREF.CoreService.COutputValue  outputValue = new ServiceREF.CoreService.COutputValue();
            ServiceREF.CoreService.CPersonRole[] list        = core_service.GetPersonRoleList(inputValue, ref outputValue);

            StringBuilder ret = new StringBuilder();

            try
            {
                string format = "\"ID\":\"{0}\", \"Code\":\"{1}\", \"Name\":\"{2}\", \"parent_id\":\"{3}\", \"level\":\"{4}\", \"isLeaf\":\"{5}\", \"expanded\":\"{6}\", \"loaded\":\"{6}\"";

                ret.AppendFormat("{{\"page\":\"{0}\",\"total\":\"{1}\",\"records\":\"{2}\",\"invdata\":[", 1, outputValue.TotalPage, outputValue.TotalRow);
                for (int i = 0; i < list.Length; i++)
                {
                    string isLeaf = list[i].ChildCount > 0 ? "false" : "true";
                    int    _level = 0;
                    if (list[i].Level > 0)
                    {
                        _level = list[i].Level - 1;
                    }
                    else if (pParentId > 0)
                    {
                        _level = pLevel + 1;
                    }
                    string item = string.Format(format, list[i].ID, list[i].Code, list[i].Name, list[i].ParentID, _level, isLeaf, "false");
                    ret.Append("{" + item + "}");
                    if (i < list.Length - 1)
                    {
                        ret.Append(",");
                    }
                }
                ret.Append("]}");
            }
            catch (Exception ex)
            {
                CLogManager.Write("ChartAccountUI:GetItems(int, string, string)", ex.ToString(), "Account");
            }
            return(ret.ToString());
        }
Example #4
0
        public string GetItems(int userId, string session, string funcPara)
        {
            //string pInput = "<COutputValue pageinfo = new COutputValue();  />";
            //if (InputValue.Length > 0)
            //    pInput = string.Format("<InputValue UserID=\"{0}\" Session=\"{1}\" {2}/>", userId, session, funcPara);
            string InputValue = CXmlPara.CreatePara(funcPara);

            COutputValue pageinfo = new COutputValue();

            CAccountList[] list = service.GetAccountList(InputValue, ref pageinfo);
            StringBuilder  ret  = new StringBuilder();

            try
            {
                string format = "\"ID\":\"{0}\", \"Code\":\"{1}\", \"AccountName\":\"{2}\", \"parent_id\":\"{3}\", \"level\":\"{4}\", \"isLeaf\":\"{5}\", \"expanded\":\"{6}\", \"loaded\":\"{6}\"";

                ret.Append("{");
                ret.AppendFormat("\"page\":\"{0}\",\"total\":\"{1}\",\"records\":\"{2}\",\"invdata\":[", 1, pageinfo.TotalPage, pageinfo.TotalRow);
                for (int i = 0; i < list.Length; i++)
                {
                    string isLeaf = list[i].ChildCount > 0 ? "false" : "true";
                    int    _level = 0;
                    if (list[i].Level.Value > 0)
                    {
                        _level = list[i].Level.Value - 1;
                    }
                    string item = string.Format(format, list[i].ID, list[i].Code, list[i].Name, list[i].ParentID, _level, isLeaf, "false");
                    ret.Append("{" + item + "}");
                    if (i < list.Length - 1)
                    {
                        ret.Append(",");
                    }
                }
                ret.Append("]}");
            }
            catch (Exception ex)
            {
                CLogManager.Write("ChartAccountUI:GetItems(int, string, string)", ex.ToString(), "Account");
            }
            return(ret.ToString());
        }
Example #5
0
        public string UpdateItem(int userID, string session, string funcPara)
        {
            //string pInput = string.Format("<InputValue UserID=\"{0}\" Session=\"{1}\" {2}/>", userID, session, funcPara);
            string InputValue = CXmlPara.CreatePara(funcPara);

            CApplicationMessage message = service.UpdateAccount(InputValue);
            StringBuilder       ret     = new StringBuilder();

            try
            {
                ret.Append("{");
                ret.AppendFormat("Code:'{0}',\n", message.Code);
                ret.AppendFormat("Name:'{0}',\n", message.Name);
                ret.AppendFormat("Result:'{0}'\n", message.Result);
                ret.Append("}");
            }
            catch (Exception ex)
            {
                CLogManager.Write("ChartAccountUI:UpdateItem", ex.ToString(), "Account");
            }
            return(ret.ToString());
        }
Example #6
0
        public string Get(string nodeId, string InputValue)
        {
            //nodeId = "1";
            //if (InputValue.Length > 0)
            string pInput = string.Format("<InputValue ParentID='{0}' {1}/>", nodeId, InputValue);

            ServiceREF.CoreService.CInterfaceFunction[] list = service.GetInterfaceFunctionByGroupID(pInput);
            StringBuilder ret = new StringBuilder();

            try
            {
                string format = "\"ID\":\"{0}\", \"Feature\":\"{1}\", \"IsUsed\":\"{2}\", \"parent_id\":\"{3}\", \"level\":\"{4}\", \"isLeaf\":\"{5}\", \"expanded\":\"{6}\", \"loaded\":\"{6}\", \"Insert\":\"{7}\", \"Update\":\"{8}\", \"Delete\":\"{9}\"";

                ret.Append("{");
                ret.AppendFormat("\"currpage\":\"{0}\",\"totalpages\":\"{1}\",\"totalrecords\":\"{2}\",\"invdata\":[", 1, 1, 10000);
                for (int i = 0; i < list.Length; i++)
                {
                    string isLeaf = list[i].ChildCount > 0 ? "false" : "true";
                    int    _level = 0;
                    if (list[i].ParentID != null && list[i].ParentID > 0)
                    {
                        _level++;
                    }
                    string item = string.Format(format, list[i].ID, list[i].Code, list[i].IsUsed, list[i].ParentID, _level, isLeaf, "false", list[i].Insert, list[i].Update, list[i].Delete);
                    ret.Append("{" + item + "}");
                    if (i < list.Length - 1)
                    {
                        ret.Append(",");
                    }
                }
                ret.Append("]}");
            }
            catch (Exception ex)
            {
                CLogManager.Write("RoleUI:Get", ex.ToString(), "ROLE");
            }
            return(ret.ToString());
        }
Example #7
0
        public static string Update(string exAttribute)
        {
            string inputValue = CXmlPara.CreatePara(exAttribute);

            ServiceREF.CoreService.CApplicationMessage message = core_service.UpdatePersonRole(inputValue);
            StringBuilder ret = new StringBuilder();

            try
            {
                ret.Append("{");
                ret.AppendFormat("IsSuccess:'{0}',\n", message.IsSuccessfull);
                ret.AppendFormat("Code:'{0}',\n", message.Code);
                ret.AppendFormat("Name:'{0}',\n", message.Name);
                ret.AppendFormat("Result:'{0}',\n", message.Result);
                ret.AppendFormat("Description:'{0}'\n", message.Description);
                ret.Append("}");
            }
            catch (Exception ex)
            {
                CLogManager.Write("CEmployeeDepartmentUI:Update", ex.ToString(), "Account");
            }
            return(ret.ToString());
        }
Example #8
0
        public string GetList(int userID, string session, string funcPara)
        {
            //string pInput = string.Format("<InputValue UserID=\"{0}\" Session=\"{1}\" {2}/>", userId, session, funcPara);
            string InputValue = CXmlPara.CreatePara(funcPara);

            ServiceREF.GeneralLedgerService.COutputValue pageinfo = new ServiceREF.GeneralLedgerService.COutputValue();
            CAccountList[] list = service.GetAccountList(InputValue, ref pageinfo);
            StringBuilder  ret  = new StringBuilder();

            ret.Append("[");
            foreach (CAccountList account in list)
            {
                if (account != null)
                {
                    try
                    {
                        ret.Append("{");
                        ret.AppendFormat("ID:'{0}',\n", account.ID);
                        ret.AppendFormat("Code:'{0}',\n", account.Code);
                        ret.AppendFormat("Name:'{0}',\n", account.Name);
                        ret.AppendFormat("ParentID:'{0}',\n", account.ParentID);
                        ret.AppendFormat("Type:'{0}'\n", account.ParentID);
                        ret.Append("}");
                    }
                    catch (Exception ex)
                    {
                        CLogManager.Write("ChartAccountUI:GetList(int, string, string)", ex.ToString(), "Account");
                    }
                    if (account != list[list.Length - 1])
                    {
                        ret.Append(",");
                    }
                }
            }
            ret.Append("]");
            return(ret.ToString());
        }
Example #9
0
        public static string DeleteReport(string pFileName, string pLocation)
        {
            string ret = "09";

            try
            {
                string _path = "";
                if (pLocation.Trim() == "")
                {
                    _path = CReportConfig.Report_Url;
                }
                else
                {
                    _path = CReportConfig.Report_Url + pLocation + "/";
                }
                _path = Path.Combine(_path, pFileName);
                if (CReportConfig.IsDebug)
                {
                    CLogManager.Write("ReportFunction.DeleteReport", "Filename: " + _path, "Report");
                }
                if (File.Exists(_path))
                {
                    File.Delete(_path);
                    ret = "00|Delete " + pFileName + " sucessful";
                }
                else
                {
                    ret = "01|File " + pFileName + " not exits";
                }
            }
            catch (Exception ex)
            {
                ret = "99|Delete file " + pFileName + " error.";
                CLogManager.WritePL("ReportFunction.DeleteReport", ex.Message);
            }
            return(ret);
        }