Example #1
0
    protected void ODS_GV_UomConversion_OnDeleting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        UomConversion uomConversion    = (UomConversion)e.InputParameters[0];
        UomConversion delUomConversion = TheUomConversionMgr.LoadUomConversion(uomConversion.Id);

        itemMessage[0] = delUomConversion.Item == null ? string.Empty : delUomConversion.Item.Code;
        itemMessage[1] = delUomConversion.BaseQty.ToString();
        itemMessage[2] = delUomConversion.BaseUom.Code;
        itemMessage[3] = delUomConversion.AlterQty.ToString();
        itemMessage[4] = delUomConversion.AlterUom.Code;
    }
Example #2
0
    protected void ODS_UomConversion_Inserting(object source, ObjectDataSourceMethodEventArgs e)
    {
        UomConversion uomConversion = (UomConversion)e.InputParameters[0];

        string itemCode = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbItemCode"))).Text;
        string altUom   = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbAltUom"))).Text;
        string baseUom  = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbBaseUom"))).Text;

        itemMessage[0] = itemCode;
        itemMessage[1] = uomConversion.BaseQty.ToString();
        itemMessage[2] = baseUom;
        itemMessage[3] = uomConversion.AlterQty.ToString();
        itemMessage[4] = altUom;

        //if (itemCode == null || itemCode.Trim() == string.Empty)
        //{
        //    ShowWarningMessage("MasterData.UomConversion.Required.itemCode", "");
        //    e.Cancel = true;
        //    return;
        //}
        if (altUom == null || altUom.Trim() == string.Empty)
        {
            ShowWarningMessage("MasterData.UomConversion.Required.altUom", "");
            e.Cancel = true;
            return;
        }
        if (altUom == baseUom)
        {
            ShowWarningMessage("MasterData.UomConversion.Same.Uom", baseUom);
            e.Cancel = true;
            return;
        }
        if (baseUom == null || baseUom.Trim() == string.Empty)
        {
            ShowWarningMessage("MasterData.UomConversion.Required.baseUom", "");
            e.Cancel = true;
            return;
        }
        if (TheUomConversionMgr.LoadUomConversion(itemCode, altUom, baseUom) == null && TheUomConversionMgr.LoadUomConversion(itemCode, baseUom, altUom) == null)
        {
            uomConversion.Item     = TheItemMgr.LoadItem(itemCode);
            uomConversion.AlterUom = TheUomMgr.LoadUom(altUom);
            uomConversion.BaseUom  = TheUomMgr.LoadUom(baseUom);
            ShowSuccessMessage("MasterData.UomConversion.AddUomConversion.Successfully", itemMessage);
        }
        else
        {
            e.Cancel = true;
            ShowErrorMessage("MasterData.UomConversion.AddUomConversion.Error", itemMessage);
            return;
        }
    }
Example #3
0
    protected void ODS_GV_UomConversion_OnUpdating(object source, ObjectDataSourceMethodEventArgs e)
    {
        UomConversion uomConversion = (UomConversion)e.InputParameters[0];
        UomConversion oldConversion = TheUomConversionMgr.LoadUomConversion(uomConversion.Id);

        uomConversion.BaseUom  = oldConversion.BaseUom;
        uomConversion.AlterUom = oldConversion.AlterUom;
        uomConversion.Item     = oldConversion.Item;

        itemMessage[0] = oldConversion.Item == null ? string.Empty : oldConversion.Item.Code;
        itemMessage[1] = uomConversion.BaseQty.ToString();
        itemMessage[2] = oldConversion.BaseUom.Code;
        itemMessage[3] = uomConversion.AlterQty.ToString();
        itemMessage[4] = oldConversion.AlterUom.Code;
        ShowSuccessMessage("MasterData.UomConversion.UpdateUomConversion.Successfully", itemMessage);
    }