Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Title = "Đơn vị tính";
     if (!string.IsNullOrWhiteSpace(Request["id"]))
     {
         _ivUnit = Module.IvUnitGetById(Convert.ToInt32(Request["id"]));
     }
     if (!IsPostBack)
     {
         FillParent();
         FillInfo();
     }
 }
Exemplo n.º 2
0
        public static double ConvertRateParentUnit(int quanity, IvUnit unit)
        {
            var result = 0.0;

            if (unit.Parent != null)
            {
                var rate = unit.Rate;
                if (unit.Math == "/")
                {
                    result = Convert.ToDouble(quanity) / Convert.ToDouble(rate);
                }
                else if (unit.Math == "*")
                {
                    result = quanity * rate;
                }
            }
            else
            {
                result = quanity;
            }
            return(result);
        }