Esempio n. 1
0
    public string InsertVendorType(ClsVendorType data)
    {
        string errMsg = "";
        PuroTouchSQLDataContext puroTouchContext = new PuroTouchSQLDataContext();

        try
        {
            tblVendorType oNewRow = new tblVendorType()
            {
                idVendorType = (Int32)data.idVendorType,
                VendorType   = data.VendorType,
                CreatedBy    = data.CreatedBy,
                CreatedOn    = (DateTime?)data.CreatedOn,
                //UpdatedBy = data.UpdatedBy,
                //UpdatedOn = (DateTime?)data.UpdatedOn,
                ActiveFlag = data.ActiveFlag
            };



            puroTouchContext.GetTable <tblVendorType>().InsertOnSubmit(oNewRow);
            // Submit the changes to the database.
            puroTouchContext.SubmitChanges();
            //newID = oNewRow.idTaskType;
        }
        catch (Exception ex)
        {
            errMsg = ex.Message.ToString();
        }
        return(errMsg);
    }
        internal void Update(VendorTypeModel model)
        {
            tblVendorType newobj = objData.tblVendorTypes.Where(p => p.VendorTypeId == model.VendorTypeId).FirstOrDefault(); //GetVendorTypes().Where(p => p.VendorTypeId == model.VendorTypeId).FirstOrDefault();

            newobj.VendorType = model.VendorType;
            if (!string.IsNullOrEmpty(model.TypeImagesPath))
            {
                newobj.TypeImagesPath = model.TypeImagesPath;
            }
            objData.SaveChanges();
        }
        public int Save(VendorTypeModel tbl)
        {
            tblVendorType vendortype = new tblVendorType()
            {
                IsDelete       = false,
                VendorType     = tbl.VendorType,
                VendorTypeId   = tbl.VendorTypeId,
                TypeImagesPath = tbl.TypeImagesPath,
            };

            //tbl.IsDelete = false;
            objData.tblVendorTypes.Add(vendortype);
            objData.SaveChanges();
            return(vendortype.VendorTypeId.Value);
        }