Example #1
0
    public string createAndReturnIdGenerated(Commodity entity)
    {
        ErrorOccur = false;
        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@CommodityCode", entity.CommodityCode);
            DM.Load_SP_Parameters("@Commodity", entity.CommidityName);

            idGenerated = DM.Execute_StoreProcedure_Scalar("CommodityMaster_NewCommodity", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #2
0
    public bool create(Commodity entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@CommodityCode", entity.CommodityCode);
            DM.Load_SP_Parameters("@Commodity", entity.CommidityName);

            result = DM.Execute_StoreProcedure("CommodityMaster_NewCommodity", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #3
0
    public string createAndReturnIdGenerated(Token entity)
    {
        ErrorOccur = false;
        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@Token", entity.TokenNumber);
            DM.Load_SP_Parameters("@Subject", entity.Subject);
            DM.Load_SP_Parameters("@SubjectKey", entity.SubjectKey.ToString());
            DM.Load_SP_Parameters("@DeadDate", entity.DeadDate.ToString("G"));
            DM.Load_SP_Parameters("@Acknowledgement", entity.Acnkowledgment);

            idGenerated = DM.Execute_StoreProcedure_Scalar("TokenMaster_NewToken", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #4
0
    public string createAndReturnIdGenerated(User entity, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        string idGenerated = "";

        //try
        //{
        //    DM.Load_SP_Parameters("@PartNumber", entity.PartNumber);
        //    DM.Load_SP_Parameters("@PartDescription", entity.Description);
        //    DM.Load_SP_Parameters("@UM", entity.Um);
        //    DM.Load_SP_Parameters("@PartMaterial", entity.Material);
        //    DM.Load_SP_Parameters("@Cost", entity.Cost.ToString());
        //    DM.Load_SP_Parameters("@CapsonicPN", entity.CapsonicPN);
        //    DM.Load_SP_Parameters("@CustomerPN", entity.CustomerPN);
        //    DM.Load_SP_Parameters("@ManufacturePN", entity.ManufacturePN);
        //    DM.Load_SP_Parameters("@SupplierPN", entity.SupplierPN);
        //    DM.Load_SP_Parameters("@CommCode", entity.CommCode);
        //    //DM.Load_SP_Parameters("@EAU", entity.EAU.ToString());

        //    idGenerated = DM.Execute_StoreProcedure_Scalar_Open_Conn("UserMaster_NewUser", true);

        //    ErrorOccur = DM.ErrorOccur;
        //    ErrorMessage = DM.Error_Mjs;
        //}
        //catch (Exception e)
        //{
        //    ErrorOccur = true;
        //    ErrorMessage = e.Message;
        //    return "";
        //}

        return(idGenerated);
    }
Example #5
0
    public bool take(long bomDetailKey, string user)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@BOMDetailKey", bomDetailKey.ToString());
            DM.Load_SP_Parameters("@AssignedTo", user);

            result = DM.Execute_StoreProcedure("TakeBOM", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #6
0
    public IList <Commodity> readAll()
    {
        List <Commodity> recordset = new List <Commodity>();

        recordset.Clear();
        DM = connectionManager.getDataManager();

        string query = "SELECT      CommodityKey, CommodityCode, Commodity " +
                       "FROM       CommodityMaster ORDER BY Commodity";

        DataTable table = new DataTable();

        table = DM.Execute_Query(query);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            Commodity commodity = new Commodity();
            commodity.Id            = long.Parse(table.Rows[i][0].ToString());
            commodity.CommodityCode = table.Rows[i][1].ToString();
            commodity.CommidityName = table.Rows[i][2].ToString();

            recordset.Add(commodity);
        }

        return(recordset);
    }
Example #7
0
    public string createAndReturnIdGenerated(Supplier_Commodity entity)
    {
        ErrorOccur = false;
        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@SupplierKey", entity.SupplierKey.ToString());
            DM.Load_SP_Parameters("@CommodityKey", entity.CommodityKey.ToString());

            idGenerated = DM.Execute_StoreProcedure_Scalar("SupplierCommodity_New", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #8
0
    public bool update(User entity, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        bool result = false;

        //try
        //{
        //    DM.Load_SP_Parameters("@UserMasterKey", entity.Id.ToString());
        //    DM.Load_SP_Parameters("@PartNumber", entity.PartNumber);
        //    DM.Load_SP_Parameters("@PartDescription", entity.Description);
        //    DM.Load_SP_Parameters("@UM", entity.Um);
        //    DM.Load_SP_Parameters("@PartMaterial", entity.Material);
        //    DM.Load_SP_Parameters("@Cost", entity.Cost.ToString());
        //    DM.Load_SP_Parameters("@CapsonicPN", entity.CapsonicPN);
        //    DM.Load_SP_Parameters("@CustomerPN", entity.CustomerPN);
        //    DM.Load_SP_Parameters("@ManufacturePN", entity.ManufacturePN);
        //    DM.Load_SP_Parameters("@SupplierPN", entity.SupplierPN);
        //    DM.Load_SP_Parameters("@CommCode", entity.CommCode);
        //    //DM.Load_SP_Parameters("@EAU", entity.EAU.ToString());

        //    result = DM.Execute_StoreProcedure_Open_Conn("UserMaster_EditUser", true);

        //    ErrorOccur = DM.ErrorOccur;
        //    ErrorMessage = DM.Error_Mjs;
        //}
        //catch (Exception e)
        //{
        //    ErrorOccur = true;
        //    ErrorMessage = e.Message;
        //    return false;
        //}

        return(result);
    }
Example #9
0
    public bool create(Token entity, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        bool result = false;

        try
        {
            DM.Load_SP_Parameters("@Token", entity.TokenNumber);
            DM.Load_SP_Parameters("@Subject", entity.Subject);
            DM.Load_SP_Parameters("@SubjectKey", entity.SubjectKey.ToString());
            DM.Load_SP_Parameters("@DeadDate", entity.DeadDate.ToString("G"));
            DM.Load_SP_Parameters("@Acknowledgement", entity.Acnkowledgment);

            result = DM.Execute_StoreProcedure_Open_Conn("TokenMaster_NewToken", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #10
0
    public IList <Token> readAll()
    {
        List <Token> recordset = new List <Token>();

        recordset.Clear();
        DM = connectionManager.getDataManager();

        string query = "SELECT TokenKey, Token, [Subject], SubjectKey, DeadDate, Acknowledgement FROM TokenMaster " +
                       "ORDER BY TokenKey DESC";

        DataTable table = new DataTable();

        table = DM.Execute_Query(query);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            Token token = new Token();
            token.Id             = long.Parse(table.Rows[i][0].ToString());
            token.TokenNumber    = table.Rows[i][1].ToString();
            token.Subject        = table.Rows[i][2].ToString();
            token.SubjectKey     = long.Parse(table.Rows[i][3].ToString());
            token.DeadDate       = DateTime.Parse(table.Rows[i][4].ToString());
            token.Acnkowledgment = table.Rows[i][5].ToString();

            recordset.Add(token);
        }

        return(recordset);
    }
Example #11
0
    public bool update(Token entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@TokenKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@Token", entity.TokenNumber);
            DM.Load_SP_Parameters("@Subject", entity.Subject);
            DM.Load_SP_Parameters("@SubjectKey", entity.SubjectKey.ToString());
            DM.Load_SP_Parameters("@DeadDate", entity.DeadDate.ToString("G"));
            DM.Load_SP_Parameters("@Acknowledgement", entity.Acnkowledgment);
            //sys_active not as a parameter in Store Procedure

            result = DM.Execute_StoreProcedure("TokenMaster_EditToken", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #12
0
    public string createAndReturnIdGenerated(Item entity)
    {
        ErrorOccur = false;
        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@PartNumber", entity.PartNumber);
            DM.Load_SP_Parameters("@PartDescription", entity.Description);
            DM.Load_SP_Parameters("@UM", entity.Um);
            DM.Load_SP_Parameters("@PartMaterial", entity.Material);
            DM.Load_SP_Parameters("@Cost", entity.Cost.ToString());
            DM.Load_SP_Parameters("@CapsonicPN", entity.CapsonicPN);
            DM.Load_SP_Parameters("@CustomerPN", entity.CustomerPN);
            DM.Load_SP_Parameters("@ManufacturePN", entity.ManufacturePN);
            DM.Load_SP_Parameters("@SupplierPN", entity.SupplierPN);
            DM.Load_SP_Parameters("@CommCode", entity.CommCode);
            //DM.Load_SP_Parameters("@EAU", entity.EAU.ToString());

            idGenerated = DM.Execute_StoreProcedure_Scalar("ItemMaster_NewItem", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #13
0
    public bool update(Item entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@ItemMasterKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@PartNumber", entity.PartNumber);
            DM.Load_SP_Parameters("@PartDescription", entity.Description);
            DM.Load_SP_Parameters("@UM", entity.Um);
            DM.Load_SP_Parameters("@PartMaterial", entity.Material);
            DM.Load_SP_Parameters("@Cost", entity.Cost.ToString());
            DM.Load_SP_Parameters("@CapsonicPN", entity.CapsonicPN);
            DM.Load_SP_Parameters("@CustomerPN", entity.CustomerPN);
            DM.Load_SP_Parameters("@ManufacturePN", entity.ManufacturePN);
            DM.Load_SP_Parameters("@SupplierPN", entity.SupplierPN);
            DM.Load_SP_Parameters("@CommCode", entity.CommCode);
            //DM.Load_SP_Parameters("@EAU", entity.EAU.ToString());

            result = DM.Execute_StoreProcedure("ItemMaster_EditItem", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #14
0
    public bool update(Customer entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@CustomerKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@CustomerName", entity.CustomerName);

            result = DM.Execute_StoreProcedure("CustomerMaster_EditCustomer", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #15
0
    public string createAndReturnIdGenerated(Supplier entity)
    {
        ErrorOccur = false;
        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@SupplierName", entity.SupplierName);
            DM.Load_SP_Parameters("@ContactName", entity.ContactName);
            DM.Load_SP_Parameters("@ContactPhoneNumber", entity.ContactPhone);
            DM.Load_SP_Parameters("@ContactEmail", entity.ContactEmail);
            DM.Load_SP_Parameters("@ManufacturingLocation", entity.ManufacturingLocation);
            DM.Load_SP_Parameters("@ShipLocation", entity.ShipLocation);
            DM.Load_SP_Parameters("@QuotedCurrency", entity.QuotedCurrency);
            DM.Load_SP_Parameters("@Capabilities", entity.Capabilities);
            DM.Load_SP_Parameters("@Comments", entity.Comments);
            DM.Load_SP_Parameters("@Visible", entity.Visible.ToString());
            DM.Load_SP_Parameters("@Commodity", entity.Commodity);
            DM.Load_SP_Parameters("@ContactCellPhoneNumber", entity.ContactCellPhone);

            idGenerated = DM.Execute_StoreProcedure_Scalar("SupplierMaster_NewSupplier", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #16
0
    public bool update(Commodity entity, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        bool result = false;

        try
        {
            DM.Load_SP_Parameters("@ItemMasterKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@CommodityCode", entity.CommodityCode);
            DM.Load_SP_Parameters("@Commodity", entity.CommidityName);

            result = DM.Execute_StoreProcedure_Open_Conn("CommodityMaster_EditCommodity", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #17
0
    public IList <Supplier_Commodity> readAll()
    {
        List <Supplier_Commodity> recordset = new List <Supplier_Commodity>();

        recordset.Clear();
        DM = connectionManager.getDataManager();

        string query = "SELECT     SupplierCommodityKey, SupplierKey, CommodityKey " +
                       "FROM         Supplier_Commodity " +
                       "ORDER BY SupplierKey";

        DataTable table = new DataTable();

        table = DM.Execute_Query(query);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            Supplier_Commodity supplier_Commodity = new Supplier_Commodity();
            supplier_Commodity.Id           = long.Parse(table.Rows[i][0].ToString());
            supplier_Commodity.SupplierKey  = long.Parse(table.Rows[i][1].ToString());
            supplier_Commodity.CommodityKey = long.Parse(table.Rows[i][2].ToString());

            recordset.Add(supplier_Commodity);
        }

        return(recordset);
    }
Example #18
0
    public string createAndReturnIdGenerated(BOM entity)
    {
        ErrorOccur = false;

        string idGenerated = "";

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@SIFHeaderKey", entity.SifId.ToString());
            DM.Load_SP_Parameters("@TopPartNumber", entity.TopPartNumber);
            DM.Load_SP_Parameters("@PartDescription", entity.PartDescription);
            DM.Load_SP_Parameters("@Revision", entity.Revision);
            DM.Load_SP_Parameters("@AnnualVolume", entity.AnnualVolume.ToString());

            idGenerated = DM.Execute_StoreProcedure_Scalar("BOMHeader_NewBOM", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return("");
        }

        return(idGenerated);
    }
Example #19
0
    public IList <BOM> readAll(string filter)
    {
        List <BOM> recordset = new List <BOM>();

        recordset.Clear();
        DM = connectionManager.getDataManager();

        string query = "SELECT BOMHeaderKey, SIFHeaderKey, TopPartNumber, PartDescription, " +
                       "Revision, InquiryNumber, AnnualVolume,  MarketSector, SalesPerson, CustomerName, AssignedTo " +
                       "FROM viewBOMHeader_ReadAll " + filter + " ORDER BY PartDescription";
        DataTable table = new DataTable();

        table = DM.Execute_Query(query);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            BOM bom = new BOM();
            bom.Id              = long.Parse(table.Rows[i][0].ToString());
            bom.SifId           = long.Parse(table.Rows[i][1].ToString());
            bom.TopPartNumber   = table.Rows[i][2].ToString();
            bom.PartDescription = table.Rows[i][3].ToString();
            bom.Revision        = table.Rows[i][4].ToString();
            bom.InquiryNumber   = table.Rows[i][5].ToString();
            bom.AnnualVolume    = int.Parse(table.Rows[i][6].ToString());
            bom.MarketSector    = table.Rows[0][7].ToString();
            bom.SalesPerson     = table.Rows[0][8].ToString();
            bom.CustomerName    = table.Rows[0][9].ToString();
            bom.AssignedTo      = table.Rows[0][10].ToString();

            recordset.Add(bom);
        }

        return(recordset);
    }
Example #20
0
    public bool update(Supplier_Commodity entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@SupplierCommodityKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@SupplierKey", entity.SupplierKey.ToString());
            DM.Load_SP_Parameters("@CommodityKey", entity.CommodityKey.ToString());

            result = DM.Execute_StoreProcedure("SupplierCommodity_Edit", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #21
0
    public bool create(BOM entity, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        bool result = false;

        try
        {
            DM.Load_SP_Parameters("@SIFHeaderKey", entity.SifId.ToString());
            DM.Load_SP_Parameters("@TopPartNumber", entity.TopPartNumber);
            DM.Load_SP_Parameters("@PartDescription", entity.PartDescription);
            DM.Load_SP_Parameters("@Revision", entity.Revision);
            DM.Load_SP_Parameters("@AnnualVolume", entity.AnnualVolume.ToString());

            result = DM.Execute_StoreProcedure_Open_Conn("BOMHeader_NewBOM", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #22
0
    public bool update(BOM entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@BOMHeaderKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@SIFHeaderKey", entity.SifId.ToString());
            DM.Load_SP_Parameters("@TopPartNumber", entity.TopPartNumber);
            DM.Load_SP_Parameters("@PartDescription", entity.PartDescription);
            DM.Load_SP_Parameters("@Revision", entity.Revision);
            DM.Load_SP_Parameters("@AnnualVolume", entity.AnnualVolume.ToString());
            DM.Load_SP_Parameters("@sys_active", true.ToString());

            result = DM.Execute_StoreProcedure("BOMHeader_EditBOM", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }
        return(result);
    }
Example #23
0
    public IList <MarketSector> readAll()
    {
        List <MarketSector> recordset = new List <MarketSector>();

        recordset.Clear();
        DM = connectionManager.getDataManager();

        string query = "SELECT MarketSectorID, Name " +
                       "FROM MarketSector " +
                       "ORDER BY Name";

        DataTable table = new DataTable();

        table = DM.Execute_Query(query);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            MarketSector marketSector = new MarketSector();
            marketSector.Id   = long.Parse(table.Rows[i][0].ToString());
            marketSector.Name = table.Rows[i][1].ToString();

            recordset.Add(marketSector);
        }

        return(recordset);
    }
Example #24
0
    private string createSIF()
    {
        GatewayResponse response = new GatewayResponse();

        String s   = new StreamReader(Request.InputStream).ReadToEnd();
        SIF    sif = JsonConvert.DeserializeObject <SIF>(s);

        String authUser = HttpContext.Current.User.Identity.Name;

        sif.AssignedTo = authUser;

        /*Begin Transaction*/
        ConnectionManager CM = new ConnectionManager();

        Data_Base_MNG.SQL DM = CM.getDataManager();

        DM.Open_Connection("SIF Create");

        string idGenerated = sif_CRUD.createAndReturnIdGenerated(sif, ref DM);

        if (sif_CRUD.ErrorOccur)
        {
            response.ErrorThrown         = true;
            response.ResponseDescription = "ERROR:" + sif_CRUD.ErrorMessage;
            return(JsonConvert.SerializeObject(response));
        }
        else
        {
            sif.Id = long.Parse(idGenerated);

            foreach (SIFDetail sifVolume in sif.SifDetail)
            {
                sifVolume.SifHeaderKey = sif.Id;
                if (!sifDetail_CRUD.create(sifVolume, ref DM))
                {
                    response.ErrorThrown         = true;
                    response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage;
                    return(JsonConvert.SerializeObject(response));
                }
            }
        }

        DM.CommitTransaction();
        DM.Close_Open_Connection();

        if (DM.ErrorOccur)
        {
            response.ErrorThrown         = true;
            response.ResponseDescription = "ERROR:" + DM.Error_Mjs;
            return(JsonConvert.SerializeObject(response));
        }

        response.ErrorThrown         = false;
        response.ResponseDescription = "SIF created successfully.";
        response.Result = sif;
        return(JsonConvert.SerializeObject(response));
    }
Example #25
0
    private string saveSIF()
    {
        GatewayResponse response = new GatewayResponse();

        String s   = new StreamReader(Request.InputStream).ReadToEnd();
        SIF    sif = JsonConvert.DeserializeObject <SIF>(s);

        /*Begin Transaction*/
        ConnectionManager CM = new ConnectionManager();

        Data_Base_MNG.SQL DM = CM.getDataManager();

        DM.Open_Connection("SIF Update");
        if (!sif_CRUD.update(sif, ref DM))
        {
            response.ErrorThrown         = true;
            response.ResponseDescription = "ERROR:" + sif_CRUD.ErrorMessage;
            return(JsonConvert.SerializeObject(response));
        }

        if (!sifDetail_CRUD.deleteByParentID(sif.Id, ref DM))
        {
            response.ErrorThrown         = true;
            response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage;
            return(JsonConvert.SerializeObject(response));
        }


        foreach (SIFDetail sifVolume in sif.SifDetail)
        {
            sifVolume.SifHeaderKey = sif.Id;
            if (!sifDetail_CRUD.create(sifVolume, ref DM))
            {
                response.ErrorThrown         = true;
                response.ResponseDescription = "ERROR:" + sifDetail_CRUD.ErrorMessage;
                return(JsonConvert.SerializeObject(response));
            }
        }

        DM.CommitTransaction();
        DM.Close_Open_Connection();

        if (DM.ErrorOccur)
        {
            response.ErrorThrown         = true;
            response.ResponseDescription = "ERROR:" + DM.Error_Mjs;
            return(JsonConvert.SerializeObject(response));
        }

        response.ErrorThrown         = false;
        response.ResponseDescription = "SIF updated successfully.";
        response.Result = getSIFbyID(sif.Id);
        return(JsonConvert.SerializeObject(response));
    }
Example #26
0
 public Data_Base_MNG.SQL getDataManager()
 {
     try
     {
         DMG = new Data_Base_MNG.SQL(server, database, user, pass);
         return(DMG);
     }
     catch (Exception e)
     {   //TODO: log e in a future
         return(null);
     }
 }
Example #27
0
    public bool update(BOMDetail entity)
    {
        ErrorOccur = false;
        bool result = false;

        DM = connectionManager.getDataManager();
        try
        {
            DM.Load_SP_Parameters("@BOMDetailKey", entity.Id.ToString());
            DM.Load_SP_Parameters("@BOMHeaderKey", entity.BomHeaderKey.ToString());
            DM.Load_SP_Parameters("@ItemMasterKey", entity.ItemMasterkey.ToString());
            DM.Load_SP_Parameters("@Qty", entity.Qty.ToString());
            DM.Load_SP_Parameters("@Cost", entity.Cost.ToString());
            DM.Load_SP_Parameters("@Status", entity.Status);
            DM.Load_SP_Parameters("@Description", entity.Description);
            DM.Load_SP_Parameters("@LinePosition", entity.LinePosition);
            DM.Load_SP_Parameters("@SalesStatus", entity.SalesStatus);
            DM.Load_SP_Parameters("@User", entity.User);
            DM.Load_SP_Parameters("@PurchasingStatus", entity.PurchasingStatus);
            DM.Load_SP_Parameters("@DirectedBuy", entity.DirectedBuy.ToString());
            DM.Load_SP_Parameters("@Material", entity.Material);
            DM.Load_SP_Parameters("@Um", entity.Um);
            DM.Load_SP_Parameters("@VendorQuoteEst", entity.VendorQuoteEst);
            DM.Load_SP_Parameters("@SalesComments", entity.SalesComments);
            DM.Load_SP_Parameters("@PurchasingComments", entity.PurchasingComments);
            DM.Load_SP_Parameters("@CapComAssm", entity.CapComAssm);
            DM.Load_SP_Parameters("@CapsonicPN", entity.CapsonicPN);
            DM.Load_SP_Parameters("@CustomerPN", entity.CustomerPN);
            DM.Load_SP_Parameters("@ManufacturePN", entity.ManufacturePN);
            DM.Load_SP_Parameters("@SupplierPN", entity.SupplierPN);
            DM.Load_SP_Parameters("@CommCode", entity.CommCode);
            DM.Load_SP_Parameters("@sys_active", true.ToString());
            DM.Load_SP_Parameters("@Sequence", entity.Sequence.ToString());
            DM.Load_SP_Parameters("@AttachmentsFolder", entity.AttachmentsFolder);

            result = DM.Execute_StoreProcedure("BOMDetail_EditDetail", true);

            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
        }
        catch (Exception e)
        {
            ErrorOccur   = true;
            ErrorMessage = e.Message;
            return(false);
        }

        return(result);
    }
Example #28
0
    public bool setActiveBySurveyID(long id, byte bActive, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        string query = "UPDATE TokenMaster SET sys_active=" + bActive + " WHERE [Subject] = 'SURVEY' AND SubjectKey=" + id;

        if (DM.Execute_Command_Open_Connection(query))
        {
            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
            return(true);
        }
        ErrorOccur   = DM.ErrorOccur;
        ErrorMessage = DM.Error_Mjs;
        return(false);
    }
Example #29
0
    public bool setActive(long id, byte bActive, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        string query = "UPDATE BOMDetail SET sys_active=" + bActive + " WHERE BOMDetailKey=" + id;

        if (DM.Execute_Command_Open_Connection(query))
        {
            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
            return(true);
        }
        ErrorOccur   = DM.ErrorOccur;
        ErrorMessage = DM.Error_Mjs;
        return(false);
    }
Example #30
0
    public bool delete(long id, ref Data_Base_MNG.SQL DM)
    {
        ErrorOccur = false;
        string query = "DELETE FROM BOMDetail WHERE BOMDetailKey=" + id;

        if (DM.Execute_Command_Open_Connection(query))
        {
            ErrorOccur   = DM.ErrorOccur;
            ErrorMessage = DM.Error_Mjs;
            return(true);
        }
        ErrorOccur   = DM.ErrorOccur;
        ErrorMessage = DM.Error_Mjs;
        return(false);
    }