コード例 #1
0
ファイル: GroupPrice.cs プロジェクト: LavoTP/Arad.SMS.Gateway
        public static bool Insert(Common.GroupPrice groupPrice, string agentRatio)
        {
            Business.GroupPrice groupPriceController = new Business.GroupPrice();
            try
            {
                XDocument doc           = new XDocument();
                XElement  root          = new XElement("NewDataSet");
                int       countOperator = Helper.GetInt(Helper.ImportData(agentRatio, "resultCount"));

                for (int counterOpearor = 0; counterOpearor < countOperator; counterOpearor++)
                {
                    XElement element = new XElement("Table");
                    element.Add(new XElement("AgentID", Helper.ImportData(agentRatio, ("AgentID" + counterOpearor))));
                    element.Add(new XElement("Ratio", Helper.ImportDecimalData(agentRatio, ("NewRatio" + counterOpearor))));
                    root.Add(element);
                }
                doc.Add(root);

                groupPrice.AgentRatio = doc.ToString();
                return(groupPriceController.Insert(groupPrice) != Guid.Empty ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }