public static Common.GroupPrice LoadGroupPrice(Guid groupPriceGuid) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); Common.GroupPrice groupPrice = new Common.GroupPrice(); groupPriceController.Load(groupPriceGuid, groupPrice); return(groupPrice); }
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; } }
public static DataTable GetGroupPrices(Guid userGuid, Guid parentGuid) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); Common.User user = User.LoadUser(userGuid); parentGuid = parentGuid == Guid.Empty ? userGuid : parentGuid; if (!user.IsFixPriceGroup) { return(groupPriceController.GetGroupPrices(parentGuid)); } else { return(new DataTable()); } }
public static bool CheckExistRange(Guid userGuid, Guid groupPriceGuid, long minimumMessage, long maximumMessage) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); DataTable dtRanges = groupPriceController.CheckExistRange(userGuid); bool isValid = true; foreach (DataRow row in dtRanges.Rows) { if ((minimumMessage >= Helper.GetLong(row["MinimumMessage"]) && minimumMessage <= Helper.GetLong(row["MaximumMessage"])) || (maximumMessage >= Helper.GetLong(row["MinimumMessage"]) && maximumMessage <= Helper.GetLong(row["MaximumMessage"]))) { if (Helper.GetGuid(row["Guid"]) != groupPriceGuid) { isValid = false; } break; } } return(isValid); }
public static bool UpdateGroupPrice(Common.GroupPrice groupPrice, string agentRatio, bool isMainAdmin) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); decimal currentRatio; decimal newRatio; try { XDocument doc = new XDocument(); XElement element; XElement root = new XElement("NewDataSet"); int countOperator = Helper.GetInt(Helper.ImportData(agentRatio, "resultCount")); for (int counter = 0; counter < countOperator; counter++) { element = new XElement("Table"); element.Add(new XElement("AgentID", Helper.ImportData(agentRatio, ("AgentID" + counter)))); currentRatio = Helper.ImportDecimalData(agentRatio, ("CurrentRatio" + counter)); newRatio = Helper.ImportDecimalData(agentRatio, ("NewRatio" + counter)); if (newRatio < currentRatio && !isMainAdmin) { throw new Exception(Language.GetString("RatioNotValid")); } element.Add(new XElement("Ratio", Helper.ImportDecimalData(agentRatio, ("NewRatio" + counter)))); root.Add(element); } doc.Add(root); groupPrice.AgentRatio = doc.ToString(); return(groupPriceController.UpdateGroupPrice(groupPrice)); } catch (Exception ex) { throw ex; } }
public static DataTable GetPagedGroupPrices(Guid userGuid) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); return(groupPriceController.GetPagedGroupPrices(userGuid)); }
public static decimal GetUserBaseSmsPrice(Guid userGuid, Guid parentGuid, long smsCount, ref bool decreaseTax) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); return(groupPriceController.GetUserBaseSmsPrice(userGuid, parentGuid, smsCount, ref decreaseTax)); }
public static Guid GetDefaultGroupPrice(string domain) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); return(groupPriceController.GetDefaultGroupPrice(domain)); }
public static bool DeleteGroupPrice(Guid groupPriceGuid) { Business.GroupPrice groupPriceController = new Business.GroupPrice(); return(groupPriceController.Delete(groupPriceGuid)); }